Remove default model from Codex MCP config

This commit is contained in:
Mohamed Boudra
2025-12-24 19:14:33 +07:00
parent 457ea43259
commit 9f6c9f64e3
3 changed files with 7 additions and 9 deletions

View File

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

View File

@@ -87,7 +87,6 @@ const CODEX_MODES: AgentMode[] = [
];
const DEFAULT_CODEX_MODE_ID = "auto";
const DEFAULT_CODEX_MODEL_ID = "gpt-5.1-codex";
const MODE_PRESETS: Record<
string,
@@ -219,14 +218,17 @@ function buildCodexMcpConfig(
const sandbox = config.sandboxMode ?? preset.sandbox;
const extra = config.extra?.codex ?? undefined;
return {
const configPayload: Record<string, unknown> = {
prompt,
cwd: config.cwd,
model: config.model ?? DEFAULT_CODEX_MODEL_ID,
"approval-policy": approvalPolicy,
sandbox,
config: extra,
};
if (typeof config.model === "string" && config.model.length > 0) {
configPayload.model = config.model;
}
return configPayload;
}
function isUnsupportedChatGptModelError(error: unknown): boolean {
@@ -715,10 +717,6 @@ class CodexMcpAgentSession implements AgentSession {
}
this.updateIdentifiersFromResponse(response);
if (this.modelRejected && !this.runtimeModel) {
this.runtimeModel = DEFAULT_CODEX_MODEL_ID;
}
if (!turnState.sawAssistant) {
const text = extractTextContent(response);
if (text) {

View File

@@ -74,12 +74,13 @@ Build a new Codex MCP provider sidebyside with the existing Codex SDK prov
- 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**: Remove hardcoded default model - passthrough user choice.
- [x] **Fix**: Remove hardcoded default model - passthrough user choice.
- Pass `config.model` if user specifies one.
- If user doesn't specify, omit `model` field - let Codex CLI pick its default.
- Do NOT hardcode any fallback model in the provider.
- Tests should not specify a model unless testing model passthrough.
- **Done (2025-12-24 19:14)**: Dropped the default model constant, omitted `model` from MCP config when unset, and removed the hardcoded fallback in runtime info; adjusted Codex MCP runtime test to avoid specifying a model.
- [ ] **Review**: Flag ALL workarounds/hacks in `codex-mcp-agent.ts` - they are NOT acceptable.