Fix codex mcp default model

This commit is contained in:
Mohamed Boudra
2025-12-24 18:58:49 +07:00
parent 75c2a96068
commit 899dafff35
3 changed files with 13 additions and 4 deletions

View File

@@ -504,7 +504,7 @@ describe("CodexMcpAgentClient (MCP integration)", () => {
provider: "codex-mcp",
cwd,
modeId: "full-access",
model: "gpt-4.1",
model: "gpt-5.1-codex",
} as AgentSessionConfig;
let session: AgentSession | null = null;

View File

@@ -87,6 +87,7 @@ const CODEX_MODES: AgentMode[] = [
];
const DEFAULT_CODEX_MODE_ID = "auto";
const DEFAULT_CODEX_MODEL_ID = "gpt-5.1-codex";
const MODE_PRESETS: Record<
string,
@@ -221,7 +222,7 @@ function buildCodexMcpConfig(
return {
prompt,
cwd: config.cwd,
model: config.model,
model: config.model ?? DEFAULT_CODEX_MODEL_ID,
"approval-policy": approvalPolicy,
sandbox,
config: extra,
@@ -716,7 +717,7 @@ class CodexMcpAgentSession implements AgentSession {
this.updateIdentifiersFromResponse(response);
if (this.modelRejected && !this.runtimeModel) {
this.runtimeModel = "default";
this.runtimeModel = DEFAULT_CODEX_MODEL_ID;
}
if (!turnState.sawAssistant) {

10
plan.md
View File

@@ -59,11 +59,19 @@ Build a new Codex MCP provider sidebyside with the existing Codex SDK prov
- The reference supports permissions - copy the working approach.
- **Done (2025-12-24 18:53)**: Matched happy-cli elicitation flow by avoiding duplicate permission requests when exec events pre-seed pending entries and aligned permission tool naming with CodexBash.
- [ ] **Fix**: Use valid model instead of gpt-4.1.
- [ ] **Fix**: Test `approval-policy=untrusted` instead of `on-request`.
- Happy CLI uses `"untrusted"` for default mode, voice-dev uses `"on-request"`.
- `"on-request"` may not trigger MCP elicitation.
- Change MODE_PRESETS["auto"] to use `"untrusted"` and test if real elicitation works.
- If it works, remove the synthetic permission gating workaround.
- [x] **Fix**: Use valid model instead of gpt-4.1.
- gpt-4.1 does not exist and is rejected by Codex CLI.
- Check what models are actually available (run `codex --help` or check docs).
- Update tests and provider to use a valid default model.
- **Done (2025-12-24 18:58)**: Updated Codex MCP default model to gpt-5.1-codex and switched runtime info test to use the valid model id.
- [ ] **Fix**: Resolve typecheck errors in `codex-mcp-agent.ts`.