Skip to content

Codex lock compiler places --model flag before exec subcommand #33838

@lpcox

Description

@lpcox

Problem

The Codex command template generated by gh aw compile places the model flag before the exec subcommand, causing Codex to ignore it and fall back to its default model.

Generated (broken):

codex ${GH_AW_MODEL_AGENT_CODEX:+-c model="$GH_AW_MODEL_AGENT_CODEX" }exec -c web_search="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check "$INSTRUCTION"

Expected:

codex exec ${GH_AW_MODEL_AGENT_CODEX:+--model "$GH_AW_MODEL_AGENT_CODEX" }-c web_search="disabled" --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check "$INSTRUCTION"

Impact

  • All Codex workflows with a custom model (e.g., gpt-5.1-codex-mini) silently fall back to the default model (gpt-5.3-codex)
  • Users pay for the more expensive default model when they explicitly requested a cheaper one
  • Still present in v0.74.4

Root Cause

The lock compiler emits the model config as -c model=... before the exec subcommand. Codex CLI treats flags before a subcommand as global options and does not recognize -c model in that position. After exec, it becomes a valid option.

Fix

In the Codex command template generation, move the model parameter to after exec:

- codex ${GH_AW_MODEL_AGENT_CODEX:+-c model="$GH_AW_MODEL_AGENT_CODEX" }exec ...
+ codex exec ${GH_AW_MODEL_AGENT_CODEX:+--model "$GH_AW_MODEL_AGENT_CODEX" }...

Note: newer Codex versions use --model as a direct flag to exec rather than -c model=....

References

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompiler

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions