fix(codex-acp): honor config.toml model for custom providers (web chat)#2
Merged
Merged
Conversation
…-5.5 Patch @agentclientprotocol/codex-acp@0.0.44 so web chat honors the model configured in ~/.codex/config.toml (e.g. a custom provider's MiniMax-M3) instead of silently forcing the built-in default model. codex-acp's createModelId() looked up the configured/returned model id in codex's listModels() catalog and, when absent (custom providers expose no catalog entry), substituted availableModels.find(m => m.isDefault) — i.e. gpt-5.5. That id was then pinned onto every runTurn, so requests sent to a custom endpoint failed with `unknown model 'gpt-5.5'`. The codex CLI handles the same case by keeping the configured model id and just warning "Model metadata not found. Defaulting to fallback metadata." This patch mirrors that: keep modelId when it isn't in the catalog; only fall back to isDefault when no modelId was provided at all. Downstream session state already degrades gracefully (supportedReasoningEfforts ?? [], inputModalities ?? ["text","image"]). Verified end-to-end through bridge-server.js: session advertises MiniMax-M3[high] and a prompt turn completes with a real MiniMax reply. 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
Web 对话选 Codex + 自定义 provider(如 MiniMax)时,即便
~/.codex/config.toml配了model = "MiniMax-M3",请求仍发出gpt-5.5并报错:{"error":{"message":"unknown model 'gpt-5.5'","code":"invalid_prompt"}}(关联 1agents issue openclaw#43,由 openclaw#41 vendor ACP adapters 暴露。)
Root cause
不在 1acp。1acp 全程没注入 model:bridge-server.js 只设
sessionOptions.systemPrompt,applyRequestedModelIfAdvertised无 model 时是 no-op,codex-acp 启动也无--model。真正原因在 vendored
@agentclientprotocol/codex-acp@0.0.44的createModelId():它在 codexlistModels()目录里找配置的 model,自定义 provider 的 model 不在目录中 → 回退到isDefault(= gpt-5.5),并把它钉死在每个runTurn上。Codex CLI 对同样情况是保留配置的 model id,仅警告 "Model metadata not found"。Fix
通过
pnpm patch给 codex-acp 打补丁,行为对齐 CLI:目录里找不到就保留配置的 model id,只有 model id 为 null 时才回退 isDefault。下游 session state 对未知模型已有兜底(supportedReasoningEfforts ?? []、inputModalities ?? ["text","image"])。变更:
patches/@agentclientprotocol__codex-acp@0.0.44.patch(新增)package.json的patchedDependenciespnpm-lock.yamlVerification
pnpm install后 ACP 探针:session/new的currentModelId从gpt-5.5→MiniMax-M3[high]。你好正常回复,不再有unknown model。Upstream
同等修复已提到 codex-acp 上游:agentclientprotocol/codex-acp#199。上游合并发版后可移除本补丁。