Skip to content

fix(tui): exit on empty non-interactive stdin - #42235

Closed
xichen1997 wants to merge 1 commit into
anomalyco:devfrom
xichen1997:tui-eof-exit
Closed

xichen1997 wants to merge 1 commit into
anomalyco:devfrom
xichen1997:tui-eof-exit

Conversation

@xichen1997

@xichen1997 xichen1997 commented Aug 13, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #42234

Type of change

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

What does this PR do?

Exits before starting the TUI when stdin is non-interactive, reaches EOF, and no prompt was provided. This prevents OpenCode from holding an active exec session indefinitely and blocking auto-sleep.

Docker reproduction:

docker run -d --name opencode-eof node:22-bookworm-slim sleep infinity
docker exec opencode-eof npm install -g [email protected]
timeout -s KILL 8s docker exec opencode-eof opencode </dev/null
docker top opencode-eof -eo pid,ppid,tty,stat,etime,args

How did you verify your code works?

  • Added a real CLI subprocess regression test with ignored stdin.
  • Ran the targeted TUI tests and repository typecheck.

Screenshots / recordings

Not applicable.

Checklist

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

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Related PRs found:

  1. fix(tui): isolate tool stdin #41613 - fix(tui): isolate tool stdin

    • Related to stdin handling in the TUI; may address similar concerns about stdin interaction with tools
  2. fix(tui): prevent piped stdin from breaking UI and keyboard input #34242 - fix(tui): prevent piped stdin from breaking UI and keyboard input

    • Directly related to preventing piped/non-interactive stdin from disrupting the TUI

These PRs appear to address related stdin management issues, though #42235 specifically targets the EOF+non-interactive stdin case to prevent indefinite session hangs and enable auto-sleep. The other PRs focus on broader stdin isolation and UI protection.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@xichen1997
xichen1997 marked this pull request as ready for review August 13, 2026 04:34
@gszr

gszr commented Aug 17, 2026

Copy link
Copy Markdown

I am affected by this issue. Would love to see it merged.

@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 stays alive with EOF stdin and no TTY

2 participants