Skip to content

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

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

fix(tui): exit on empty non-interactive stdin#42235
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 opencode-ai@1.18.18
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI stays alive with EOF stdin and no TTY

1 participant