Skip to content

Fix Codex profile reasoning_effort and verbosity defaults#140

Merged
allenzhou101 merged 2 commits into
mainfrom
fix/codex-reasoning-effort-default
May 28, 2026
Merged

Fix Codex profile reasoning_effort and verbosity defaults#140
allenzhou101 merged 2 commits into
mainfrom
fix/codex-reasoning-effort-default

Conversation

@allenzhou101

Copy link
Copy Markdown
Contributor

Summary

The Codex CLI defaults both model_reasoning_effort and model_verbosity
to "low", but gpt-5.2-codex (the default Codex model) only accepts
"medium" for both. Out-of-the-box codex exec against the AI Gateway
fails with:

Unsupported value: 'low' is not supported with the 'gpt-5.2-codex' model. Supported values are: 'medium'.

The error covers both the reasoning.effort and text.verbosity request
parameters, depending on which the model rejects first.

This PR sets both fields to "medium" in two places:

  1. The generated profile config in ~/.codex/default.config.toml
    ensures the value is captured for any tool that inspects the config.
  2. Explicit -c flags on codex exec — CLI flags have the highest
    precedence and we observed the profile-only setting being silently
    overridden by the CLI's "low" default in some Codex versions.

generateCodexConfig now accepts an optional reasoningEffort argument
so callers can still override per-run via
model: "gpt-5.2-codex?reasoningEffort=high".

Test plan

  • Unit tests cover "medium" defaults and explicit-override paths
    for both AI Gateway and direct OpenAI configs (6 cases in
    src/lib/agents/codex.test.ts).
  • npm test — 184 passed | 14 skipped.
  • npm run lint clean.
  • End-to-end against the Vercel AI Gateway: verified by linking
    the patched build into a0-local
    and running a one-prompt Codex smoke. Without the fix, turn.failed
    with the Unsupported value: 'low' error within ~10s. With the fix,
    a real response is produced in ~31s.

Notes

  • Adds vercel-agent-eval-*.tgz to .gitignore so local npm pack
    artifacts don't leak into commits.
  • Stacks well with the recent
    #138 / #139 Codex profile-config fix
    — that PR fixed the legacy profile = "default" rejection; this one
    fixes the next layer (reasoning effort + verbosity defaults) so Codex
    actually completes a turn.

The Codex CLI defaults both `model_reasoning_effort` and `model_verbosity`
to "low", but `gpt-5.2-codex` (the default Codex model) only accepts
"medium" for both. Out-of-the-box `codex exec` against the AI Gateway
fails with:

  Unsupported value: 'low' is not supported with the 'gpt-5.2-codex'
  model. Supported values are: 'medium'.

The error covers both the `reasoning.effort` and `text.verbosity`
request parameters, depending on which the model rejects first.

Set both fields to "medium" in two places:
- the generated profile config in ~/.codex/default.config.toml
- explicit -c flags on `codex exec`, since CLI flags have the highest
  precedence and we observed the profile-only setting being silently
  overridden by the CLI's "low" default in some Codex versions.

`generateCodexConfig` now accepts an optional `reasoningEffort`
parameter so callers can override per-run via
`model: "gpt-5.2-codex?reasoningEffort=high"`.

Verified end-to-end against the Vercel AI Gateway: a previously-failing
`codex exec` smoke run now completes in ~31s and returns a real
response instead of erroring at `turn.failed`.

Also added `vercel-agent-eval-*.tgz` to .gitignore so local `npm pack`
artifacts don't leak into commits.
Per review feedback. Local `npm pack` artifacts can be cleaned up by
hand; no need for a project-level ignore rule.
@allenzhou101
allenzhou101 merged commit 43bec69 into main May 28, 2026
4 checks passed
@allenzhou101
allenzhou101 deleted the fix/codex-reasoning-effort-default branch May 28, 2026 18:44
@github-actions github-actions Bot mentioned this pull request May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants