fix: restore Bun stdin reads for prompt input#16300
Merged
Conversation
Use Bun.stdin.text() again for run and TUI stdin so Bun.spawn() prefilled buffers reach the compiled CLI. This avoids the regression introduced by the node:stream/consumers path.
Greptile SummaryThis PR reverts a regression introduced by the Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller as Caller (Bun.spawn / shell pipe)
participant Main as CLI entry (run.ts / thread.ts)
participant Stdin as Bun.stdin
participant Handler as Command handler
Caller->>Main: invoke opencode run / tui
Main->>Main: parse args (message, --prompt, etc.)
Main->>Main: check process.stdin.isTTY
alt stdin is NOT a TTY (piped input)
Main->>Stdin: Bun.stdin.text()
Stdin-->>Main: piped string content
Main->>Main: append piped content to message / prompt
else stdin IS a TTY (interactive)
Main->>Main: skip stdin read (piped = undefined)
end
Main->>Handler: execute with combined message/prompt
Handler-->>Caller: stream events / TUI render
Last reviewed commit: 015c785 |
jerome-benoit
pushed a commit
to jerome-benoit/opencode
that referenced
this pull request
Mar 6, 2026
qdddddd
pushed a commit
to qdddddd/opencode
that referenced
this pull request
Mar 7, 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 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
runand TUI prompt stdin reads back toBun.stdin.text()Bun.spawn({ stdin: Buffer.from(...) })in the compiled CLInode:stream/consumersstdin path that regressed prefilled stdin handlingTesting