Pass prompt via stdin in /codex skill to fix Windows argv limit (also closes #971, #1034)
Summary
The /codex skill in codex/SKILL.md invokes codex exec with the prompt as a positional argv argument in both Challenge mode (Step 2B) and Consult mode (Step 2C). When the constructed prompt exceeds roughly 32KB - which happens easily in Consult mode because Step 2C prepends the entire plan-file content to the prompt, and in Challenge mode when Claude packs a large git diff into the prompt - the invocation fails on Windows before the Codex binary ever starts.
Observed failure on gstack v0.16+ / codex-cli 0.128.0 / Windows 10 / Git Bash (msys2) / Node v22.22.1, with a ~57KB prompt:
/c/Users/<user>/AppData/Roaming/npm/codex: line 15: /c/Program Files/nodejs/node: Argument list too long
/c/Users/<user>/AppData/Roaming/npm/codex: line 15: /c/Program Files/nodejs/node: No error
Root cause is the Win32 CreateProcess ~32,767-character command-line limit (KB830473). The npm-installed codex shim launches node via Git Bash / cmd.exe and inherits that limit, so any argv larger than ~32KB never reaches the Codex Rust binary. The skill silently breaks for Windows users above that threshold, with a cryptic error from the npm shim that doesn't mention gstack, Codex, or the skill at all.
Why this is worth fixing now (and why it's not a duplicate)
This is closely related to two existing issues that complain about the same codex exec "<prompt>" pattern in skill bash blocks, from different angles:
- #971 ---
codex exechangs in skill bash blocks because stdin isn't closed (missing</dev/null). - #1034 --- same hang in
scripts/resolvers/review.tsandscripts/resolvers/design.ts, same proposed</dev/nullpatch.
Both of those propose adding </dev/null to keep stdin closed while still passing the prompt as argv. That fixes the hang but doesn't fix this Windows argv-limit case - the prompt still has to fit in CreateProcess.
There is a single change that resolves all three (#971, #1034, and this one) cleanly and follows OpenAI's documented pattern for large prompts: pipe the prompt through stdin instead of passing it as argv, using codex exec -. From the Codex CLI reference (https://developers.openai.com/codex/cli/reference): "Initial instruction for the task. Use - to pipe the prompt from stdin."
Steps to reproduce
On Windows in Git Bash, against any repo with a moderately large plan file (say >40KB):
- Have
~/.claude/plans/<project>-*.mdexist with a long plan (40-80KB is enough). - In a Claude Code session inside the project, run
/codexwith no arguments. - The skill auto-detects Consult mode and prepends the plan content to the prompt (Step 2C).
- When the assembled prompt exceeds ~32KB, the Bash invocation fails:
Bash(... PROMPT=$(cat /tmp/codex/prompt.txt); codex exec "$PROMPT" -C "$_REPO" -s read-only ...)
⤷ ---STDERR---
/c/Users/<user>/AppData/Roaming/npm/codex: line 15: /c/Program Files/nodejs/node: Argument list too long
/c/Users/<user>/AppData/Roaming/npm/codex: line 15: /c/Program Files/nodejs/node: No error
A minimal manual repro (no skill involved):
python -c "print('x' * 50000)" > /tmp/prompt.txt
PROMPT="$(cat /tmp/prompt.txt)"
codex exec "$PROMPT" -s read-only # fails with Argument list too long on Windows
codex exec - -s read-only < /tmp/prompt.txt # works on Windows
Proposed fix
In codex/SKILL.md, switch both codex exec invocations from argv to stdin:
Step 2B (Challenge mode) - current:
codex exec "<prompt>" -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached --json 2>/dev/null | python3 -c "..."
Step 2B - proposed:
printf '%s' "<prompt>" \
| codex exec - -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached --json 2>/dev/null \
| python3 -c "..."
Step 2C (Consult mode) - same transformation, both for the new-session and resumed-session forms. The <<< "<prompt>" here-string is an alternative but is bash-specific; printf '%s' "$PROMPT" | codex exec - works in any POSIX shell.
This change:
- Sidesteps the Win32
CreateProcessargv limit entirely - stdin has no such ceiling on any platform. - Naturally closes stdin (pipe reaches EOF after the prompt streams in), which also resolves #971 and #1034 without needing
</dev/nullpatches. - Follows OpenAI's documented pattern for large prompts in Codex CLI.
- Is a pure markdown / skill-template change - no binary or installer changes.
Happy to open a PR with the change if maintainers agree on the approach. I'd also suggest a follow-up audit of any other gstack skill that shells out to codex exec or similar long-prompt CLIs (autoplan, plan-eng-review, plan-ceo-review, design-review were mentioned in #1034) for the same pattern.
Environment
- gstack: latest from
main(verified pattern still present incodex/SKILL.mdStep 2B / 2C) - codex-cli: 0.128.0
- OS: Windows 10 x64
- Shell: Git Bash (msys2)
- Node: v22.22.1
- Claude Code: latest
Related
- #971 --- codex exec stdin hang (same skill bash pattern, different symptom)
- #1034 --- codex exec stdin hang in review/design resolvers (proposes
</dev/null; this issue argues the stronger fix is stdin-as-prompt)
Possibly-related downstream symptom, for whoever picks this up:
Environment: gstack 1.87.4.0, Windows 11 (10.0.26200), Git Bash (MSYS), codex-cli ~0.145–0.154 (observed across sessions on this machine).
On top of the argv-limit / quote-mangling failures described above, we've also seen codex exec crash mid-stream in /codex consult and /codex challenge — both of which pipe codex exec's stdout directly into a Python parser (codex exec ... --json | python -u -c "...", per codex/sections/consult-mode.md.tmpl and challenge-mode.md.tmpl):
thread 'codex-main' panicked at .../stdio.rs:1165:9: failed printing to stdout: パイプを閉じています。(os error 232)
os error 232 is Windows' ERROR_NO_DATA (broken-pipe equivalent) — the Python reader was gone by the time codex-main tried to write. We haven't confirmed why the Python side exits early, but given this report, a mangled/truncated argv reaching the Codex binary (rather than a clean stdin-fed prompt) seems like a plausible contributor — a corrupted or unexpectedly-shaped prompt could produce output the streaming JSON parser chokes on and exits from before codex exec is done writing.
Not filing this as a separate issue since the fix already proposed here (stdin-fed prompt via codex exec -) would remove the argv pattern that both reports share. If the stdin fix doesn't clear this crash too, happy to open a dedicated issue with more detail.
Still reproduces on gstack 1.87.4.0 (a6b3a57), and it's no longer limited to /codex. The argv pattern now lives in the shared outside-voice block (scripts/resolvers/outside-voice.ts), so every skill that renders it inherits the bug:
codex exec "$(cat "$_OUTSIDE_INPUT")" -C "$_REPO_ROOT" -s read-only ...
Generated sites on the claude host: review/sections/adversarial.md, ship/sections/adversarial.md, ship/sections/review-army.md, autoplan/sections/{ceo,design,dx,eng}-phase.md, plan-{ceo,eng,devex}-review/sections/review-sections.md, plan-design-review, design-review, design-consultation, office-hours, document-release/sections/release-body.md, spec/sections/gate-and-file.md. That's 16.
Measured 2026-09-19 on Windows 11 + Git Bash, codex-cli 0.153.4, running /review Step 5.7 exactly as written, on a 479-line diff (40,827-byte prompt):
EXIT=126 SECS=1
.../npm/codex: line 15: /c/Program Files/nodejs/node: Argument list too long
The skill then reports "Codex outside review unavailable: execution failed; missing coverage". So it reads like a Codex flake, not a gstack bug, and the pass is silently lost on every non-trivial diff.
Verified fix: the same flags with the prompt on stdin.
_gstack_codex_timeout_wrapper 540 codex exec - -C "$_REPO_ROOT" -s read-only <same -c flags> < "$_OUTSIDE_INPUT" > "$_OUTSIDE_TMP/text" 2> "$_OUTSIDE_TMP/stderr"
On the same prompt: exit 0 in 126 s, outside-review-result.ts review accepted the output, and it returned two real findings. Stdin also fixes the quoting failure in #1686, and it replaces the < /dev/null from #971 / #1034 (stdin is now the prompt, so the hang cannot occur).
Every codex exec call now reads its prompt on stdin (codex exec -) instead of argv, so large prompts no longer hit the argv limit. Fixed in v1.91.19.0 (#3025).
We could only test this on Linux, not on Windows, so I'm leaving the issue open until you can confirm. Could you upgrade (run /gstack-upgrade in Claude Code, or on Codex and other env-var hosts cd <source from ./setup --status> && git pull && ./setup --host <host>) and let us know whether it works for you? If you still see this, please add ./setup --status output here.
Thanks for the proposal. This shipped in v1.91.19.0 (#3025): every codex exec call now reads its prompt from stdin (codex exec - < file), which avoids both the Windows argv length limit and the quoting mangling in #1686. We couldn't verify it on Windows ourselves.
To confirm, upgrade with /gstack-upgrade (or git pull && ./setup) to v1.91.34.0 or later, retry, and reply here with the result and the output of ~/.claude/skills/gstack/bin/gstack-doctor. If we don't hear back in 14 days, we'll close this as fixed (reopening is always welcome).
Closing: nobody reported this again in the two weeks since the Oct 8 confirm-first note. This shipped in v1.91.19.0 (#3025): every codex exec call reads its prompt from stdin (codex exec - < file), which avoids the Windows argv limit and the quote mangling. Thanks @matedevlab for the proposal and @Richman711 for tracing it into the shared outside-voice block. @mmkimi118, the os error 232 broken pipe in /codex consult and /codex challenge is a separate problem. If you still see it on a current version, please open its own issue with the details. If it still happens on the current release (v1.91.186.0 or later), reply with your version and what you saw, and we'll reopen.