You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suspend (ctrl + z) pauses api calls for all opencode instances #5043
ctrl+z is wired to the terminal_suspend command in the shipped config (packages/opencode/src/config/config.ts:447), so hitting ctrl+z inside OpenTUI always runs that command rather than letting the terminal driver handle job control.
The command handler (added in 6afdb5c) lives in packages/opencode/src/cli/cmd/tui/app.tsx:366-377. It suspends the renderer and then calls process.kill(0, "SIGTSTP") to emulate “send the job to the background.” As the in-line comment notes, passing 0 targets the entire process group.
When you have multiple opencode TUIs that share the same process group (which is common whenever they’re launched from the same terminal session/multiplexer—WezTerm tabs, Cursor panes, tmux windows, or multiple opencode attach clients pointing at a single opencode spawn server), every process in that group receives the signal. That means the worker thread hosting the local Bun server plus any other TUIs in that group are also SIGTSTP’d, so their event loops stop processing API/network IO. They appear “hung” until a SIGCONT arrives, which matches the user’s observation that everything resumes right after they fg the instance they suspended.
The resume logic already hooks SIGCONT (app.tsx:371-373), so once the foreground job is continued, the renderer wakes up and the HTTP server continues accepting requests, letting all other instances drain their pending network work immediately.
Why the issue occurs
The new suspend implementation broadcasts SIGTSTP too broadly by signaling the whole process group (pid 0). In practice that group includes every OpenCode process launched from the same terminal session, so suspending one client inadvertently pauses the Bun worker/server that the other clients depend on, which freezes their request/response traffic until SIGCONT.
Next steps
Change the suspend handler to signal only the current job (e.g., process.kill(process.pid, "SIGTSTP") or explicitly target just the worker/TUI PIDs) instead of pid 0, or ensure each opencode invocation runs in its own process group (setpgid) before wiring ctrl+z.
Add a regression test/manual QA note: run multiple TUIs simultaneously (including in tmux/WezTerm/Cursor panes) and verify suspending one instance no longer stalls the others.
This should prevent the cascade pause described in issue Suspend (ctrl + z) pauses api calls for all opencode instances #5043 while keeping the “ctrl+z to background” feature.
Activity
github-actions commentedon Dec 4, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
Eric162 commentedon Dec 4, 2025
opencode investigating found this: