Repository navigation
fix(model): send the codex_exec prompt over stdin - #491
Open
ni (nniiovoo) wants to merge 1 commit into
Open
ni (nniiovoo) wants to merge 1 commit into
ni (nniiovoo) wants to merge 1 commit into
Conversation
The codex_exec target passed the prompt as an argument and left stdin inherited. With a prompt argument and a piped stdin, `codex exec` also reads stdin and appends it, so a run started from a pipe (the Copilot MCP plugin, `ssh host cmd`, `docker run -i`) hung until exec_timeout, or sent whatever arrived on that pipe to the model. The harness now ends the command with "-" and passes input=prompt, as codex_backend and the SkillOpt-Sleep backend do (microsoft#205). Fixes microsoft#490 Signed-off-by: NNIIOVO <haimingni44@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #490
The
codex_exectarget passed the prompt as an argument and left stdin inherited. With a prompt argument and a piped stdin,codex execalso reads stdin and appends it as a<stdin>block. So a run started from a pipe (the Copilot MCP plugin,ssh host cmd,docker run -i) either hung untilexec_timeout, or sent whatever arrived on that pipe to the model.The harness now ends the command with
-and passesinput=prompt(UTF-8,errors="replace"), the same ascodex_backendand the sleep backend since #205. That also avoids the Windowscodex.CMDshim cutting a multi-line argument (#197). The-iimage flags still come before--output-last-message, so-stays the prompt.Tests: one test added to
tests/test_codex_cli_prompt_stdin.py, next to the other two Codex call sites, using the same helper. It fails on main (noinput, prompt in argv).I also checked with a stand-in
codexthat follows the documented stdin rule, with the parent's stdin as a pipe. Before the change the rollout hung on an idle pipe, and a message written to the pipe ended up in the prompt. After it, both cases return at once with the clean prompt. No model calls.Full suite on macOS: 2632 passed. The 2 failures in
tests/test_sleep_adopt_skill_subset.pyalso fail on main.