Skip to content

/codex: GSTACK_CODEX_EFFORT env default for reasoning effort - #3098

Closed
Lockyer228 wants to merge 2 commits into
garrytan:mainfrom
Lockyer228:2975-codex-effort-env
Closed

Lockyer228 wants to merge 2 commits into
garrytan:mainfrom
Lockyer228:2975-codex-effort-env

Conversation

@Lockyer228

Copy link
Copy Markdown
Contributor

Why (in your own words)

/codex lets an operator pick the model per shell with GSTACK_CODEX_MODEL, but the reasoning effort has no equivalent default: review and challenge are pinned to high and consult to medium, the only override is the request-level --xhigh flag, and an operator who wants a different standing effort (for example max on a machine that only runs small, cheap models) has to type it on every invocation and cannot reach max at all. This change adds GSTACK_CODEX_EFFORT (minimal|low|medium|high|xhigh|max|ultra) as the default effort for manual /codex runs, mirroring GSTACK_CODEX_MODEL: unset keeps today's per-mode defaults exactly, set it becomes the default for all three modes, the request-level --xhigh still wins, and an invalid value stops before any paid call.

The value allowlist is the union of the levels documented in the Codex config reference (low, medium, high, xhigh, max, ultra) and the API reasoning guide (minimal); levels are model-dependent, so an unsupported level for a chosen model still fails at request time through the existing Model-not-supported recovery path.

Manual /codex only: gstack's own outside reviews (autoplan, spec, plan-review) keep their fixed efforts, so an operator's env default cannot change gstack's internal review budgets.

Live evidence

gstack-codex-probe check-effort before this change (unknown subcommand, usage + exit 64) and after, on this branch:

$ # unset env -> per-mode default
$ bin/gstack-codex-probe check-effort high; echo "rc=$?"
CODEX_EFFORT: high
CODEX_EFFORT: high
rc=0
$ GSTACK_CODEX_EFFORT=max bin/gstack-codex-probe check-effort high 2>/dev/null; echo "rc=$?"
CODEX_EFFORT: max
rc=0
$ GSTACK_CODEX_EFFORT=banana bin/gstack-codex-probe check-effort high; echo "rc=$?"
CODEX_EFFORT: invalid — 'banana' is not a Codex reasoning effort level. No Codex call was made.
HINT: set GSTACK_CODEX_EFFORT to one of minimal, low, medium, high, xhigh, max or ultra, or unset it to keep the per-mode defaults.
rc=1
$ bin/gstack-codex-probe check-effort banana; echo "rc=$?"
Usage: gstack-codex-probe <subcommand> [args]
...
rc=64

The generated dispatch lines change from a hardcoded effort to the captured value:

$ grep -c 'model_reasoning_effort=\"${_CODEX_EFFORT:?}\"' codex/sections/*.md.tmpl
codex/sections/challenge-mode.md.tmpl:1
codex/sections/consult-mode.md.tmpl:1
codex/sections/review-mode.md.tmpl:2

Reviewing codex exec before (any env) and after (GSTACK_CODEX_EFFORT=max) on the same branch shows the request carrying model_reasoning_effort="max" instead of the per-mode default; the review runs to a PASS/FAIL gate either way. An invalid env stops before the call:

$ GSTACK_CODEX_EFFORT=banana /codex review
CODEX_EFFORT: invalid — 'banana' is not a Codex reasoning effort level. No Codex call was made.
HINT: set GSTACK_CODEX_EFFORT to one of minimal, low, medium, high, xhigh, max or ultra, or unset it to keep the per-mode defaults.
(no codex invocation)

Tests (this branch; the check-effort contract test fails against aad7b02's lack of executable coverage and passes here):

$ bun test test/codex-effort-env.test.ts test/codex-probe-subcommands.test.ts test/codex-hardening.test.ts test/parity-suite.test.ts test/skill-size-budget.test.ts
 26 pass
 0 fail
$ bun run gen:skill-docs && git status --short   # zero diff (regenerated outputs committed)

Scope

  • Changed: bin/gstack-codex-probe (new check-effort subcommand + usage line); codex/sections/{review,challenge,consult}-mode.md.tmpl (capture _CODEX_EFFORT after the model/sandbox capture, interpolate ${_CODEX_EFFORT:?} in all five dispatch lines, explicit _CODEX_EFFORT=xhigh assignment for --xhigh); codex/SKILL.md.tmpl (env contract in "Reasoning effort override" and "Model & Reasoning"); regenerated codex/SKILL.md + codex/sections/*.md + llms.txt/agents-digest via gen:skill-docs; test/codex-effort-env.test.ts (new, 5 tests); test/codex-probe-subcommands.test.ts (check-effort in SUBCOMMANDS + behavioral contract); test/helpers/carve-guards.ts (codex skeleton budget 59,350 -> 60,250, measured 60,116, receipted in-comment).
  • Verified live by: manual probe runs above (unset/valid/invalid/empty env, bad default, injection attempt xhigh" -c "model=evil rejected exit 1); bun test free suites for codex + parity + size budgets (726 pass / 0 fail across the touched surface); tsc -p tsconfig.json clean; typecheck:test ratchet unchanged (865 known, none new); gen:skill-docs idempotent (zero diff on re-run).
  • Did NOT test: gen-skill-docs-idempotency --host all (sandbox EPERM mkdir .cursor in the review environment; default-host idempotency and --dry-run pass); a paid xhigh/ultra run end-to-end (levels accepted per Codex docs; unsupported model/level combinations surface through the existing Model-not-supported path); Windows hosts.

Liveness proof (required for external contributors)

Per prior agreement with the maintainer for this contribution, the branch is pushed from the maintainer-known account Lockyer228 (same account as PRs #2641/#2651/#2717, all absorbed into waves with Co-authored-by preserved). gh api user --jq .login from the pushing environment:

$ gh api user --jq .login
Lockyer228

Checklist

Lockyer228 and others added 2 commits October 9, 2026 13:30
…rrytan#2975)

Manual /codex runs now read GSTACK_CODEX_EFFORT (minimal|low|medium|
high|xhigh|max|ultra) as the default model_reasoning_effort for all
three modes, mirroring GSTACK_CODEX_MODEL:

- unset: per-mode defaults unchanged (review/challenge high, consult
  medium)
- set: every mode uses it; a request-level --xhigh still wins
- invalid value: the new gstack-codex-probe check-effort subcommand
  stops before any paid call with a repair hint (codex-cli itself only
  rejects an unknown effort at request time; verified on 0.155.1)
- manual /codex only: outside-voice callers (autoplan, spec,
  plan-review) keep their fixed efforts so an operator env default
  cannot change gstack's internal review budgets

Allowlist per the Codex config reference (low/medium/high/xhigh/max/
ultra) plus minimal from the API reasoning guide; levels are
model-dependent.

Regenerated skill docs via gen:skill-docs; codex skeleton budget
raised to 60,100 (measured 59,961) with the measured note.

Fixes garrytan#2975
…an#2975)

The probe contract was only read from templates, an unknown per-mode
default was coerced to medium, and --xhigh told the model to replace a
literal the dispatch no longer contains.

Co-authored-by: Cursor <[email protected]>
@trunk-io

trunk-io Bot commented Oct 9, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

capy-ai Bot pushed a commit that referenced this pull request Oct 11, 2026
…send binaries, codex_effort setting, privacy disclosures (Wave 9 Lane C) (#3144)

Outside-review consent (codex_reviews) is enforced in gstack-codex-probe
run-with-timeout, gstack-claude-code, gstack-outside-voice run and the
autoplan runner (not_run / consent_missing, exit 3; #3102). Codex reasoning
effort resolves GSTACK_CODEX_EFFORT, then codex_effort, then each gate's
default inside run-with-timeout --effort (D1-A; #3098, closes #2934). README
and telemetry privacy disclosures corrected (#1081, #1080, #1150).

Co-authored-by: Lockyer <[email protected]>
Co-authored-by: Lubos Buracinsky <[email protected]>
@capy-ai

capy-ai Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Adopted and adapted in v1.91.92.0 (3b7254a, #3144). GSTACK_CODEX_EFFORT landed as the per-run override on top of a new codex_effort config setting, resolved inside run-with-timeout --effort so every gate gets the same precedence. You're credited in the CHANGELOG and as co-author on the merged commit. Thanks @Lockyer228.

@capy-ai capy-ai Bot closed this Oct 11, 2026
levi85 pushed a commit to levi85/gstack that referenced this pull request Oct 14, 2026
…send binaries, codex_effort setting, privacy disclosures (Wave 9 Lane C) (garrytan#3144)

Outside-review consent (codex_reviews) is enforced in gstack-codex-probe
run-with-timeout, gstack-claude-code, gstack-outside-voice run and the
autoplan runner (not_run / consent_missing, exit 3; garrytan#3102). Codex reasoning
effort resolves GSTACK_CODEX_EFFORT, then codex_effort, then each gate's
default inside run-with-timeout --effort (D1-A; garrytan#3098, closes garrytan#2934). README
and telemetry privacy disclosures corrected (garrytan#1081, garrytan#1080, garrytan#1150).

Co-authored-by: Lockyer <[email protected]>
Co-authored-by: Lubos Buracinsky <[email protected]>
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