fix(opencode): keep TUI interactive with piped stdin#28540
Conversation
# Conflicts: # packages/opencode/src/cli/cmd/tui.ts # packages/tui/src/app.tsx
|
Updated this against the latest I re-tested the stdin locally, including piped stdin and |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
Hi staff team! @simonklee @thdxr @kommander @rekram1-node Could you please reopen this PR? 🙏 It was closed automatically by the bot due to age, but it fixes a real and reproducible bug that was previously reported that you wanted to be fixed since the last year: #28538, where the TUI loses interactivity and prints ANSI noise when stdin is piped. This also matches the older related reports #24195, #3871, and #6220. The fix is small and follows the same approach already used by the I recently updated it against the latest It can be validated with a simple:
I’d be very happy to contribute this fix to the project. Thanks for your time! |
Issue for this PR
Closes #28538
Related to #387, #24195 and #3930.
The root cause was never addressed. This PR includes an actual fix.
Type of change
What does this PR do?
When stdin is piped, the TUI renderer was reading input from the pipe
instead of the terminal, which broke keyboard control completely,
ANSI noise, no interaction.
The run command already handled this with resolveInteractiveStdin(),
but tui was missing it. This PR applies the same fix: pass the
controlling TTY (/dev/tty on Linux, CONIN$ on Windows) to the renderer
while still consuming the piped content as the prompt.
How did you verify your code works?
Screenshots / recordings
with the PR:

without the PR (looh the issue):
Checklist