Keep configured model id for custom providers instead of forcing the default#199
Open
scottzx wants to merge 1 commit into
Open
Conversation
… 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.
This was referenced Jun 14, 2026
scottzx
added a commit
to scottzx/1agents
that referenced
this pull request
Jun 14, 2026
Bumps modules/1acp from b54f87e to 9ca943a, pulling in the pnpm patch for @agentclientprotocol/codex-acp@0.0.44 so web chat honors the model set in ~/.codex/config.toml (e.g. a custom provider's MiniMax-M3) instead of being forced onto codex-acp's built-in default (gpt-5.5). See 1acp#2. Upstream fix: agentclientprotocol/codex-acp#199. Fixes #43 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
~/.codex/config.tomlselects a custom provider with a model the built-in catalog doesn't know about (e.g. a self-hosted or third-party endpoint), every turn is sent with the wrong model id and the request fails:{"error":{"message":"unknown model 'gpt-5.5'","code":"invalid_prompt"}}…even though the same config works fine through the Codex CLI.
Root cause
CodexAcpClient.createModelId()resolves the configured/returned model id againstlistModels()and, when it's missing, substitutesavailableModels.find(m => m.isDefault):Custom-provider model ids are not enumerated by
listModels(), so the configured model is silently replaced by the built-in default. That default id (response.model→currentModelId) is then pinned onto everyrunTurn({ model }), so requests to the custom endpoint fail withunknown model '<default>'.The Codex CLI handles the identical case differently — it keeps the configured model id and only warns:
Fix
Mirror the CLI: when the model id isn't in the advertised catalog, keep it instead of substituting the default. Only fall back to
isDefaultwhen no model id was supplied at all. Downstream session state already degrades gracefully for unknown models (supportedReasoningEfforts ?? [],inputModalities ?? ["text", "image"]).Testing
CodexAcpClient.test.tsfor an uncatalogued model id (with an explicit reasoning effort, and defaulting the effort whennull).vitest run(createModelId suite) andtsc --noEmitpass.model = "MiniMax-M3"now advertisesMiniMax-M3[high](previouslygpt-5.5) and a prompt turn completes with a real reply from the custom endpoint.