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
Problem
The Codex command template generated by
gh aw compileplaces the model flag before theexecsubcommand, causing Codex to ignore it and fall back to its default model.Generated (broken):
Expected:
Impact
gpt-5.1-codex-mini) silently fall back to the default model (gpt-5.3-codex)Root Cause
The lock compiler emits the model config as
-c model=...before theexecsubcommand. Codex CLI treats flags before a subcommand as global options and does not recognize-c modelin that position. Afterexec, it becomes a valid option.Fix
In the Codex command template generation, move the model parameter to after
exec:Note: newer Codex versions use
--modelas a direct flag toexecrather than-c model=....References