Skip to content

v1.87.6.0 feat(codex,claude): env override for outside-voice reasoning effort - #2934

Closed
lubosxyz wants to merge 1 commit into
garrytan:mainfrom
lubosxyz:upstream/codex-claude-effort-env
Closed

lubosxyz wants to merge 1 commit into
garrytan:mainfrom
lubosxyz:upstream/codex-claude-effort-env

Conversation

@lubosxyz

@lubosxyz lubosxyz commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Why (in your own words)

You can already pin the model an outside voice runs on — GSTACK_CODEX_MODEL, GSTACK_CLAUDE_MODEL
— but not how hard it thinks. Reasoning effort is written into the source in a dozen places:
scripts/resolvers/outside-voice.ts hardcodes model_reasoning_effort="high" for both the
structured-review and the codex exec form, the codex section templates hardcode "high"
(review, challenge) and "medium" (consult), and the Claude runner in lib/claude-code.ts does
not pass an effort at all.

That is fine until you are paying for it. Running /review and /ship's adversarial pass at
high on every iteration of a tight loop is real money and real latency, and the only way to turn
it down today is to edit the repo — which then fights every upgrade. The reverse case is just as
real: someone on a hard problem wants the consult pass at high for an afternoon and has no way to
say so.

This adds the missing sibling of the model override, and nothing else:

  • GSTACK_CODEX_EFFORT supplies model_reasoning_effort for gstack-owned Codex launches.
  • GSTACK_CLAUDE_EFFORT adds --effort to the Claude runner.

No default changes. With neither variable set, every launch runs at exactly the effort it runs
at on main today: high for review/challenge/adversarial and the plan/design/docs reviews,
medium for consult and the spec gate, and the Claude runner still passes no --effort flag at
all. That last one matters — passing an unrequested --effort would override the user's own CLI
configuration, so the flag is only added when the variable is actually set. I have deliberately not
brought my own policy preference upstream; that stays in my own config, which is the whole point of
making it an env var.

The mechanism copies CODEX_MODEL_CONFIG_FLAG exactly, including the double-quoted form so real
${...} shell expansion survives into the rendered skill: each call site renders
${GSTACK_CODEX_EFFORT:-<that call's default>}.

Precedence, stated precisely, because it is not uniform and a reviewer should not have to work it
out.
The variable replaces the per-mode default rather than deferring to it — with
GSTACK_CODEX_EFFORT=low, the review pass runs at low, not high. That is the intent: one knob
that means "turn everything down for this shell". What it does not touch is the --xhigh path
documented in codex/SKILL.md, because that one instructs the skill to substitute the effort
itself, so it sits outside the expansion entirely. So: request-named effort, then
GSTACK_CODEX_EFFORT, then the per-mode default. (My first draft of the README claimed an explicit
per-call effort beat the variable; it does not, and the docs in this PR say what the code does.)

One design note worth flagging for review: the new resolver takes the per-mode default as a
template argument ({{CODEX_REASONING_EFFORT_FLAG:medium}} in consult-mode), so each template keeps
its own default in its own file rather than the resolver having to know which caller it is rendering
for. That is why consult stays medium and review stays high with one shared resolver.

Live evidence

The generated output, before and after. This is the whole change as a user sees it —
codex/sections/review-mode.md keeps high, codex/sections/consult-mode.md keeps medium, and
both become overridable:

$ git diff codex/sections/review-mode.md | grep model_reasoning_effort
-_gstack_codex_timeout_wrapper 330 codex review --base <base> ... -c 'model_reasoning_effort="high"' ...
+_gstack_codex_timeout_wrapper 330 codex review --base <base> ... -c "model_reasoning_effort=\"${GSTACK_CODEX_EFFORT:-high}\"" ...

$ git diff codex/sections/consult-mode.md | grep model_reasoning_effort
-_gstack_codex_timeout_wrapper 600 codex exec "<prompt>" ... -c 'model_reasoning_effort="medium"' ...
+_gstack_codex_timeout_wrapper 600 codex exec "<prompt>" ... -c "model_reasoning_effort=\"${GSTACK_CODEX_EFFORT:-medium}\"" ...

Behaviour of the override in a real shell (the rendered line, expanded by bash, is what the
skill actually runs):

$ eval "echo $(bun -e 'import {codexReasoningEffortFlag} from "./scripts/resolvers/constants"; console.log(codexReasoningEffortFlag("high"))')"
-c model_reasoning_effort="high"

$ GSTACK_CODEX_EFFORT=xhigh eval "echo $(bun -e 'import {codexReasoningEffortFlag} from "./scripts/resolvers/constants"; console.log(codexReasoningEffortFlag("high"))')"
-c model_reasoning_effort="xhigh"

New test — test/codex-effort-env-override.test.ts, 5 tests. It pins the helper's default and
argument form, that outsideVoiceCommand renders the env form with high preserved and contains no
hardcoded model_reasoning_effort="high" literal, that the spec gate keeps medium, that
claudeCodeArgs adds no --effort on an empty env and --effort high when
GSTACK_CLAUDE_EFFORT=high, and that the rendered consult section keeps medium while review keeps
high:

$ bun test test/codex-effort-env-override.test.ts
 5 pass
 0 fail
Ran 5 tests across 1 file.

$ bun test test/codex-effort-env-override.test.ts test/skill-validation.test.ts test/provider-model-defaults.test.ts
 354 pass
 0 fail
Ran 354 tests across 3 files. [3.25s]

The test discriminates. I reverted lib/claude-code.ts and scripts/resolvers/outside-voice.ts
by hand and re-ran it:

# lib/claude-code.ts and scripts/resolvers/outside-voice.ts restored to the fork point:
$ bun test test/codex-effort-env-override.test.ts
 2 pass
 3 fail            <- the override is gone, the test says so

# both files put back:
$ bun test test/codex-effort-env-override.test.ts
 5 pass
 0 fail

The value stays in its own argument. Worth showing rather than asserting, since this is an env
var landing in a rendered command line. I reproduced the generated line verbatim in a script and
printed the child's argv for hostile values:

IN  <high>                                     argc=3 [-c] [model_reasoning_effort="high"] [--next-flag]
IN  <medium" --sandbox=danger-full-access ">    argc=3 [-c] [model_reasoning_effort="medium" --sandbox=danger-full-access ""] [--next-flag]
IN  <high; touch /tmp/PWNED>                    argc=3 [-c] [model_reasoning_effort="high; touch /tmp/PWNED"] [--next-flag]
IN  <high$(touch /tmp/PWNED2)>                  argc=3 [-c] [model_reasoning_effort="high$(touch /tmp/PWNED2)"] [--next-flag]
IN  <a b c>                                     argc=3 [-c] [model_reasoning_effort="a b c"] [--next-flag]
unset (default path)                            argc=3 [-c] [model_reasoning_effort="high"] [--next-flag]

side-effect files created: none

argc is 3 in every case: the expansion happens inside a double-quoted string that is part of the
script text, so the value is never word-split, never re-parsed for quotes, and no command
substitution runs. A value containing a quote stays inside that one argument and Codex rejects it as
a malformed config value rather than treating it as a flag. This is the same containment
${GSTACK_CODEX_MODEL:-...} already relies on; the new variable adds no new exposure.

Generator freshness (this is what skill-docs.yml checks — regenerating changes nothing, so the
committed SKILL.md files match their templates):

$ bun run gen:skill-docs --host all && git diff --exit-code && echo "generated files in sync"
generated files in sync

Free suite:

$ bun run test
Not a clean green, and I would rather show the comparison than a tick I did not earn. The full
local run fails in test/pty-screen.test.ts, test/relink.test.ts, and the Chromium and
compiled-CSO lanes. Those need artifacts CI builds first (build:gates, build:cso, vendor:xterm,
the browse node server) which I did not build, and CONTRIBUTING notes dev boxes see flakes here
while the required CI free lane turns on its retry pass.

So I measured whether this branch adds any of them. Same machine, same two files, runs
serialized one at a time:

  pristine main (35dd014c, what this branch forks from):  62 pass / 8 fail
  this branch:                                            62 pass / 8 fail

diff of the sorted failing-test lists: identical. This branch introduces no failure.

Scope

  • Changed (source): scripts/resolvers/constants.ts (CODEX_DEFAULT_EFFORT = 'high',
    codexReasoningEffortFlag(default), CODEX_REASONING_EFFORT_FLAG),
    scripts/resolvers/utility.ts (the resolver, honouring a template argument as the default),
    scripts/resolvers/index.ts (registration only — I did not touch OUTSIDE_INVOCATION's effort
    values), scripts/resolvers/outside-voice.ts (both launch forms, ?? 'high' preserved),
    lib/claude-code.ts (conditional --effort), and the three codex section templates.
    scripts/resolvers/design.ts is untouched, so design-consultation keeps medium and
    design-review keeps high.
  • Changed (generated): the SKILL.md / section outputs that render those launches, via
    bun run gen:skill-docs --host all. I edited templates and regenerated; no generated file was
    hand-edited.
  • Changed (tests/docs): new test/codex-effort-env-override.test.ts;
    test/skill-validation.test.ts's two reasoning_effort="high" assertions updated to the new
    rendered string (still asserting the high default, not weakened);
    test/provider-model-defaults.test.ts's ENV_KEYS extended so the two new variables are
    saved/cleared/restored around tests; README.md, CONTRIBUTING.md and docs/skills.md document
    the override next to GSTACK_CODEX_MODEL. VERSION → 1.87.6.0 and a CHANGELOG.md entry.
  • Verified live by: the new test, the two updated test files, bun run test, and
    bun run gen:skill-docs --host all + git diff --exit-code for the generator gate.
  • Did NOT test: a paid end-to-end /review run at a non-default effort (the change is in the
    rendered command line, which the tests assert directly); Windows; whether any given Codex model
    accepts a particular effort value — gstack passes the string through, and an invalid value fails
    in Codex the same way an invalid GSTACK_CODEX_MODEL does today.

Liveness proof (required for external contributors)

I have not attached a GSTACK PR screenshot, and I would rather explain than quietly tick the box.
This change was prepared with agent assistance on my own machine and under my own account, so an
image produced from that session would be me manufacturing the human-presence attestation the gate
exists to check. GitHub also offers no API for attaching an image to a PR body — only drag-drop in
the web UI — so that session could not have produced one honestly anyway.

What I can give you is the provenance the template asks agents for:

$ gh api user --jq .login
lubosxyz

If you want the screenshot before reviewing, say so and I will add it myself in the web UI.

Checklist

  • Liveness screenshot attached (GSTACK PR typed live into a real surface) or PR author is @garrytan (owner exemption) — not attached; see the section above, gh api user --jq .login → lubosxyz, happy to add on request
  • This is not a generated-file-only diff (I edited the source/template and regenerated)
  • No ETHOS.md edits, and no changes to voice / founder perspective / YC references
  • New public command / external service / host adapter has an accepted issue linked (or N/A) — N/A: two env vars, no new command, service or adapter
  • Linked issue or reproduction: no issue; the reproduction is test/codex-effort-env-override.test.ts, which fails if either call site is reverted

…g effort

Reasoning effort was hardcoded at every gstack-owned outside-voice launch, so
the only way to run review or consult at a different effort was to edit the
repo and refight it on the next upgrade.

GSTACK_CODEX_EFFORT now supplies model_reasoning_effort for Codex launches and
GSTACK_CLAUDE_EFFORT adds --effort to the Claude runner. Every default is
unchanged: high for review/challenge/adversarial, medium for consult and the
spec gate, and no --effort flag at all for Claude unless the variable is set,
so the CLI's own configuration is never overridden by an unrequested flag.

The flag is built the way CODEX_MODEL_CONFIG_FLAG is, so real ${...} expansion
survives into the rendered skill, and each template supplies its own per-mode
default through a resolver argument. The variable replaces that default rather
than deferring to it; an effort named in the request is substituted by the
skill itself and stays outside the expansion.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@trunk-io

trunk-io Bot commented Sep 22, 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

capy-ai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for this, @lubosxyz. It's a reasonable idea, but not one we can take right now: Fold an effort knob into the model-tier configuration from #3073 instead of adding a parallel pair of env vars. We're parking it: closing the PR and recording the idea in TODOS.md under its theme, so it isn't lost. When we pick that theme up we'll reference this PR and credit you.

@capy-ai capy-ai Bot closed this Oct 8, 2026
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

Superseded by #3144, merged in v1.91.92.0 (3b7254a). The Codex effort override shipped as GSTACK_CODEX_EFFORT plus a codex_effort setting. We declined the GSTACK_CLAUDE_EFFORT half for now. You're credited as co-author on the merged commit. Thanks @lubosxyz.

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