fix(tui): prevent piped stdin from breaking UI and keyboard input#34242
fix(tui): prevent piped stdin from breaking UI and keyboard input#34242LordMikkel wants to merge 3 commits into
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Local merge/validation note from review queue: Validated locally against current
I would not merge this yet. Remaining blockers found in review:
Also, the branch is currently stale relative to |
|
Revalidated by the merge queue on 2026-06-28 against current What passed:
Still not merging yet. The blockers from the previous review comment still apply because the head commit has not changed:
Please address those before this is merge-ready. |
|
Revalidated by the merge queue on 2026-06-28 against current What passed locally in an isolated worktree:
Still not merging. Independent review confirmed the remaining blockers:
Please address those before this is merge-ready. |
|
Revalidated by the merge queue on 2026-06-28 against current What passed locally in an isolated worktree:
Still not merging. Independent adversarial review confirmed the remaining blockers:
Please address those before this is merge-ready. |
|
@andrei-hasna Thanks for the thorough review! I addressed the blockers:
Your detailed feedback was really valuable! |
Issue for this PR
Closes #28538
Closes #24195
Closes #3871
Closes #6220
Replaces #28540, which was closed by the automated PR cleanup bot before maintainer review.
Type of change
What does this PR do?
When stdin is piped, the TUI renderer can read keyboard input from the pipe instead of the terminal. That breaks the UI and keyboard control for a simple command like:
echo "hello" | opencodeThe
runcommand already handles this withresolveInteractiveStdin(). This PR applies the same approach to the TUI: pass the controlling terminal (/dev/ttyon Linux,CONIN$on Windows) to the renderer while still consuming piped stdin as the prompt.How did you verify your code works?
bun --cwd packages/opencode test runtime.stdinbun --cwd packages/opencode typecheckecho "hello" | opencodeScreenshots / recordings
With the fix:
Without the fix:
Checklist