Uh oh!
There was an error while loading. Please reload this page.
fix(opencode): guard Bun.stdin.text() to prevent subprocess hang in non-interactive run - #1
Draft
MichaelHilton with Copilot wants to merge 1 commit into
Draft
fix(opencode): guard Bun.stdin.text() to prevent subprocess hang in non-interactive run#1MichaelHilton with Copilot wants to merge 1 commit into
MichaelHilton with Copilot wants to merge 1 commit into
Conversation
CopilotAI
changed the title
[WIP] Fix failing GitHub Actions job 'unit (linux)'fix(opencode): guard Bun.stdin.text() to prevent subprocess hang in non-interactive runAug 13, 2026
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 freeto 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.
All 10 tests in
test/cli/run/run-process.test.tstimed out because the CLI subprocess hung indefinitely before producing any output. The subprocess stderr contained onlyError: Timed out, with empty stdout and exit code-1(killed by the test harness after 30 s).Root cause
src/cli/cmd/run.tsline 416:The test harness spawns the CLI via
ChildProcess.make(..., { stdin: "ignore" })→cross-spawn→ Bun's Node.jschild_process.spawncompat layer. Withstdin: "ignore",process.stdin.isTTYisundefined(falsy), soBun.stdin.text()is always called. Bun's compat layer does not reliably redirect stdin to/dev/nullfor the"ignore"stdio option, leaving stdin as an open pipe — causingBun.stdin.text()to block forever.Fix
Guard the
Bun.stdin.text()call with an additional check so it is only invoked when stdin is actually readable:When stdin is set to
"ignore",process.stdin.readableisfalse, so the blocking read is skipped and the subprocess proceeds normally.How did you verify your code works?
Ran
bun test test/cli/run/run-process.test.tsinpackages/opencode— all 10 previously failing tests pass.Screenshots / recordings
N/A — no UI change.
Checklist