codex exec resume and fork silently drop piped stdin when given a prompt
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in codex-rs/exec/src/lib.rs: compare resolve_root_prompt with the resolve_prompt calls used by resume and fork, then inspect the relevant CLI help and tests. Add coverage for positional prompts with piped stdin in both commands, keeping the - cases as controls. Done means stdin is preserved or the combination is explicitly rejected or warned about, with tests confirming the behavior.
Written by the indexing model from the issue text.
Description
Summary
When both a positional prompt and piped stdin are supplied, codex exec appends stdin as a <stdin> block, but codex exec resume and codex exec fork silently discard it. All three commands exit successfully, so an automation can continue without the intended context.
Reproduction
Tested on Windows with codex-cli 0.167.0-alpha.4.1 and SDK fixture source at 6bfdc75f0d9e6fae313234f694839866d7c63c39. Configure an isolated CODEX_HOME with the repository's local mock Responses provider in sdk/python/tests/app_server_harness.py; capture its request input:
# Obtain ID from the thread.started event in the first command.
printf ROOT_PIPE_MARKER | codex exec --json --skip-git-repo-check "root question"
printf RESUME_PIPE_MARKER | codex exec --json --skip-git-repo-check resume "$ID" "resume question"
printf FORK_PIPE_MARKER | codex exec --json --skip-git-repo-check fork "$ID" "fork question"
printf STDIN_SENTINEL_MARKER | codex exec --json --skip-git-repo-check resume "$ID" -
The captured last user inputs were, respectively:
root question\n\n<stdin>\nROOT_PIPE_MARKER\n</stdin>
resume question
fork question
STDIN_SENTINEL_MARKER
All four calls exited 0 and used the local mock, not an external model. The main codex exec --help describes appending piped stdin alongside a prompt; the resume and fork help describe - for reading stdin.
Expected / possible fix
Apply the same positional-prompt-plus-stdin behavior to resume and fork, or explicitly reject or warn about the combination so input is not silently lost. The fresh path uses resolve_root_prompt, while resume and fork use resolve_prompt when a prompt is supplied. Add tests for both commands with a positional prompt and piped input, plus the - control.
Workaround: combine the question and context into stdin and pass - as the prompt.
- Dominant language
- Rust
- Stars
- 135k
- Forks
- 21.4k
- Avg merge
- 1m
- Merged PRs (30d)
- 995
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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 openai/codex
-
bug CLI config
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
app-server bug CLI
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug CLI exec
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug CLI exec windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
app-server bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
compatibility
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
aws/aws-emulator#30 · 1 comment ·
-
tormach-plasma refusal text with no machine reads "no machine is not declared a plasma machine"Openarea:post bug effort:low P2 source:agent
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Higher Interval Candles draws nothing on a seconds chart whose interval does not divide two hoursOpenbug studies
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
userFRM/egui-charts#2727 ·
Maintainers usually reply within 1 day
-
enhancement priority::low upstream
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day