Pass prompt via stdin in /codex skill to fix Windows argv limit (also closes #971, #1034)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Read codex/SKILL.md, focusing on the Challenge mode Step 2B and Consult mode Step 2C codex exec invocations, including new-session and resumed-session forms. Reproduce the long-prompt behavior with the supplied stdin and argv commands, then verify that all affected invocations accept prompts through stdin and still produce the expected Codex output.
Written by the indexing model from the issue text.
Description
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)
- Dominant language
- TypeScript
- Stars
- 134k
- Forks
- 19.9k
- Avg merge
- 20h 59m
- Merged PRs (30d)
- 21
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from garrytan/gstack
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100