fix(run-codex-exec): handle stdin EPIPE gracefully and pass prompt via env - #162
Open
Alphaxiaoteng wants to merge 1 commit into
Open
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Alphaxiaoteng
force-pushed
the
fix/handle-stdin-epipe-and-hide-prompt-argv
branch
from
August 25, 2026 07:50
efcdc65 to
c119e2e
Compare
Author
|
recheck |
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.
Summary
errorevents onchild.stdininrunCodexExec()so fast startup exits or unhandledEPIPEexceptions do not crash the action process as an unhandled EventEmitter error.--prompt-envinrun-codex-exec, and switchesaction.ymlto pass the prompt via environment variable name rather than expanding full prompt text intonode dist/main.jscommand line arguments (preventing command-line length limits on Windows and unnecessary process listing exposure).Changes
src/runCodexExec.ts:PromptSourcewith{ type: "env", variableName: string }.child.stdin.on("error", ...)handler to gracefully ignoreEPIPEand settle the supervision promise with the child's actual exit code.resolve/rejectto prevent double-settlement if pipe closes concurrently.src/main.ts:--prompt-envCLI option forrun-codex-exec.emptyAsNull()to safely handle undefined options.action.yml:--prompt-env CODEX_PROMPTwheninputs.promptis set, avoiding putting the whole prompt body in argv.test/stdinEpipeAndPromptEnv.test.mjs:--prompt-env.process.exit(42)) with in-flight stdin write settles cleanly with exit code 42 without uncaught EPIPE exceptions.Verification
npm run buildcleanly compiled with esbuild.npm testpassed: 146/146 tests passing.