Skip to content

feat(codex): start a codex session at a chosen reasoning effort - #515

Open
irisitymichaelgrundberg wants to merge 2 commits into
Ark0N:masterfrom
irisitymichaelgrundberg:feat/codex-reasoning-effort
Open

irisitymichaelgrundberg wants to merge 2 commits into
Ark0N:masterfrom
irisitymichaelgrundberg:feat/codex-reasoning-effort

Conversation

@irisitymichaelgrundberg

@irisitymichaelgrundberg irisitymichaelgrundberg commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Part of #513 (the Codex half).

codexConfig takes a new reasoningEffort, and a codex session starts with --config model_reasoning_effort=<level>.

Why

A caller can pick codex's model per session through codexConfig.model, but not its reasoning effort, so every session starts at whatever ~/.codex/config.toml says. Claude sessions already take an effort per session through effort.

What it does

  • CODEX_REASONING_EFFORTS in src/types/session.ts lists the levels codex accepts as of codex-cli 0.154.0: none, minimal, low, medium, high, xhigh, max and ultra. Which of them a given model honours is codex's call. CodexConfig gets a matching reasoningEffort field.
  • The schema admits only those words. CodexConfigSchema validates reasoningEffort as an enum built from that list, so both POST /api/sessions and POST /api/quick-start reject anything else.
  • The registry emits one literal per level. An argv token can't splice a parameter into a literal, and codex wants model_reasoning_effort=<level> as one --config value. The Codex entry therefore declares a reasoningEffort enum parameter and one --config model_reasoning_effort=<level> argument per level, each gated on its own value. A level the enum doesn't know emits nothing. The registry needed no new argument shape for this.
  • The arguments come after --model and before the resume <id> subcommand, so a resumed session keeps its effort too.

The "Codex specifics" list in docs/architecture-invariants.md now names the two --config values codex takes from codexConfig. codexConfig already round-trips through SessionState, so the effort survives a respawn and a Codeman restart. npm run generate:cli-catalog -- --check reports the catalogue in sync, because launch arguments aren't part of it.

Testing

  • npm test passes, as do typecheck, lint, format and the catalogue check.
  • test/cli-registry-spawn-golden.test.ts gains two cases:
    • one renders the launch command for every level;
    • one pins the order with a model and a resume id, codex --model gpt-5 --config model_reasoning_effort=high resume roll_42.
  • The new test/codex-reasoning-effort-schema.test.ts checks that both create schemas accept every level, and that both reject unknown words and shell characters.
  • test/routes/external-cli-bypass-clamp.test.ts checks that a non-granted owner in multi-user mode keeps the effort when the clamp forces bypass off.
  • By hand, codex --config model_reasoning_effort=xhigh starts codex-cli 0.154.0 with gpt-5.6-sol xhigh in its header, where the user config says medium. Codex needs no extra quoting around the level.

No changeset, following the repository's convention for contributors.

🤖 Generated with Claude Code

codexConfig takes a `reasoningEffort`, one of the levels codex accepts,
and the session starts with `--config model_reasoning_effort=<level>`.
The registry declares one literal per level, gated on the enum, because
an argv token cannot splice a value into a literal.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ser clamp

Both create schemas now refuse an unknown level, and a non-granted owner's
codexConfig keeps its reasoningEffort when the clamp forces bypass off.
docs/architecture-invariants.md lists the two --config values codex now
takes from codexConfig.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@irisitymichaelgrundberg
irisitymichaelgrundberg marked this pull request as ready for review October 2, 2026 04:49
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.

1 participant