Repository navigation
TUI spontaneously stops with SIGTTOU or SIGTTIN on macOS Bash #51600
Description
Description
The TUI renders normally, then becomes job-control stopped after several
seconds without pressing Ctrl-Z. Bash returns to the prompt while OpenCode
remains stopped, and moving the mouse produces SGR mouse-reporting fragments
such as 35;52;22M.
This reproduces with the raw executable, not only through a shell alias or
function.
Plugins
openusage-telemetry.ts and orca-opencode-status.js, but the failure also
reproduces with --pure.
OpenCode version
1.18.32 (latest release). The Homebrew 1.18.30 binary also reproduces.
Steps to reproduce
-
Start an interactive Bash shell with job control enabled.
-
Run
command opencode --auto. -
Wait approximately 10-20 seconds without pressing Ctrl-Z.
-
Bash reports:
[1]+ 31119 Stopped (tty output): 22 command opencode --auto -
Moving the mouse now writes SGR mouse events into the shell.
The same test with command opencode attach http://127.0.0.1:4096 stops with:
[1]+ 43595 Stopped (tty input): 21 command opencode attach http://127.0.0.1:4096
After the default-mode stop, process state was:
PID PPID PGID TPGID STAT COMMAND
28778 79088 28778 28778 Ss+ -bash
31119 28778 31119 28778 T opencode --auto
OpenCode initially owns the foreground TTY, then Bash reclaims it after the
stop. This suggests a foreground-process-group problem followed by SIGTTOU or
SIGTTIN, rather than an intentional suspend.
Isolation performed:
-
Reproduces in Ghostty directly and in a Herdr-managed PTY.
-
Reproduces with OpenCode 1.18.30 and 1.18.32.
-
Reproduces with
--pure, ruling out configured plugins. -
Reproduces in both the combined default TUI and
attachmode. -
Running the interactive TUI with Bash monitor mode temporarily disabled
keeps Bash and OpenCode in the same foreground PGID and remains stable:set +m command opencode --auto set -m
Expected behavior
OpenCode should remain the foreground job until explicitly exited or
suspended, and it should restore terminal mouse/input modes whenever stopped.
Related issues
- bug: mouse garbling after inactivity — missing SIGTSTP handler #20506 and bug: missing SIGTSTP handler causes mouse garbling when process is externally suspended opentui#906 cover missing terminal cleanup after an
external stop, but not the spontaneous stop or foreground-PGID loss. - bug: mouse escape sequences garbled after TUI exit #20458 covers leaked mouse sequences after exit.
- opencode (default mode) closes entire terminal window on Linux / i3wm #24077 may involve the same combined TUI startup area, but reports the
terminal closing rather than Bash receiving SIGTTIN/SIGTTOU. - Bun.spawn crashes when running bash interactive oven-sh/bun#17500 describes a related foreground-process-group failure in
Bun.
Operating System
macOS 27.0 (26A428), arm64
Terminal
Ghostty 1.3.1 and Herdr 0.7.5-preview.2026-07-29-44b3adb12552, TERM=xterm-256color
Shell: GNU Bash 5.3.20
Activity
github-actions commentedon Sep 27, 2026
For keybind-related issues, please also check our pinned keybinds documentation: #4997
djbclark commentedon Sep 27, 2026
Two additional results:
opencode2v2.0.18 remained foreground for 20 seconds in the same Bash/PTY setup where v1 consistently stops within 10-20 seconds. Its PGID and the TTY foreground PGID both remained59659. This suggests the v2 TUI architecture may already avoid the initiating job-control failure.attachmode when monitor mode is disabled around the TUI. After 25 seconds, Bash andopencode attachshared foreground PGID62945; without the workaround, attach stopped with SIGTTIN (21).No authentication setup was needed for the v2 test because existing provider credentials were detected.
simonklee commentedon Sep 27, 2026
@djbclark thanks, ill have a look at this.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊