Skip to content

fix(tui): isolate tool stdin - #41613

Closed
mathew-cf wants to merge 1 commit into
anomalyco:devfrom
mathew-cf:isolate-tool-stdin
Closed

mathew-cf wants to merge 1 commit into
anomalyco:devfrom
mathew-cf:isolate-tool-stdin

Conversation

@mathew-cf

Copy link
Copy Markdown

Issue for this PR

Closes #41612

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The TUI now reads from a dedicated controlling-terminal stream while fd 0 is redirected to the platform null device. Tool implementations and their subprocesses therefore receive EOF instead of competing with the TUI for keystrokes. The dedicated stream is also used by external editors and Windows console-mode handling.

This builds on the dedicated TUI input-stream work in #34242 by @LordMikkel and extends it to isolate tool subprocess stdin.

How did you verify your code works?

  • Typechecked packages/opencode and packages/tui
  • Ran the packages/opencode/test/cli/run suite
  • Ran the full packages/tui suite
  • Verified under a pseudo-terminal that a subprocess inheriting fd 0 receives EOF
  • Ran the internal AI reviewer twice; the final review found no blocking issues

Screenshots / recordings

Not applicable; this fixes terminal input ownership without changing the rendered UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

The search found PR #34242 which is a related prior work that this PR explicitly builds upon (as mentioned in the description), but no duplicate or conflicting PRs addressing the same issue.

@github-actions

Copy link
Copy Markdown
Contributor

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:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI input can be consumed by tool subprocesses

1 participant