Commit c5b32b5
committed
fix: keep configured model id for custom providers instead of forcing the default
createModelId() looked up the configured/returned model id in Codex's
listModels() catalog and, when it was absent, substituted
availableModels.find(m => m.isDefault). Custom providers (self-hosted or
third-party endpoints) expose model ids that the catalog does not enumerate,
so this silently replaced the user's configured model with the built-in
default. That default id was then pinned onto every runTurn, making requests
to the custom endpoint fail with "unknown model '<default>'".
The Codex CLI handles the same case by keeping the configured model id and
warning "Model metadata not found. Defaulting to fallback metadata." This
change mirrors that behavior: keep the requested model id when it is not in
the catalog, and only fall back to isDefault when no model id was provided
at all. Downstream session state already degrades gracefully for unknown
models (supportedReasoningEfforts ?? [], inputModalities ?? ["text","image"]).
Adds unit tests covering an uncatalogued model id with and without an
explicit reasoning effort.1 parent 5a0a2c2 commit c5b32b5
2 files changed
Lines changed: 30 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
381 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
382 | 396 | | |
383 | | - | |
| 397 | + | |
| 398 | + | |
384 | 399 | | |
385 | 400 | | |
386 | 401 | | |
387 | | - | |
| 402 | + | |
388 | 403 | | |
389 | 404 | | |
390 | 405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
969 | 979 | | |
970 | 980 | | |
971 | 981 | | |
| |||
0 commit comments