Repository navigation
Description
Description
On OpenCode V2 (opencode2) on Windows, a TUI session remained permanently running after a shell tool launched a long-lived GUI process with PowerShell Start-Process. The direct PowerShell process had exited, but the tool remained running, preventing the parent session from consuming completed subagent notifications and queued user input.
This was server state, not only stale TUI rendering:
GET /api/session/active
parent session: running
both child sessions: absent (idle)
parent tool state: running
tool: shell
direct pwsh process: no longer present
GET /api/session/{parent}/inbox
2 synthetic subagent completion messages
2 queued user messages
Both child sessions already contained final assistant messages with finish: stop. Sending POST /interrupt to either child correctly behaved as an idle no-op, despite the TUI presenting the child as still in progress.
The workaround was:
POST /api/session/{parent}/background
It immediately changed the outer shell tool state to completed, emptied the inbox, and allowed the parent to resume. The detached GUI process remained alive and responsive, as intended.
Plugins: opencode-ponytail, opencode-gemini-auth@latest, ponytail-v2.mjs; local integration plugins for After Effects, Blender, Microsoft 365, Resolve, and Unreal.
OpenCode version: 0.0.0-beta-17793 (build commit 4d22d4e75fb949db5a6302cc605e9af87ea671bf)
Steps to reproduce
The same failure has occurred twice. These are the exact observed steps; a controlled reproduction has not yet been run, so the frequency is currently intermittent.
- In a parent TUI session on Windows, start two subagents.
- Run a PowerShell shell tool that uses
Start-Process -PassThruwith redirected stdout/stderr to launch a long-lived GUI executable, then checks that the GUI is alive and listening. - Allow the direct PowerShell process to exit while the detached GUI remains running.
- Allow both subagents to finish and submit additional user messages to the parent.
- Observe that both child sessions have final answers and are absent from
/api/session/active, while the parent and its shell tool remainrunningand completion/user messages accumulate in the parent inbox. - Call
POST /api/session/{parent}/background; observe that the tool completes and the parent immediately consumes its inbox.
Relevant observed transition:
{
"before": {
"toolState": "running",
"runningToolProcessPresent": false,
"parentInboxItems": 4
},
"afterBackground": {
"toolState": "completed",
"toolResult": "The command was moved to the background.",
"metadataStatus": "running",
"parentInboxItems": 0
}
}Expected: once the direct shell process exits, the tool should complete or transition to background observation without retaining foreground ownership of the parent session. Completed subagents and queued input should then be consumed normally.
Actual: foreground ownership remained attached to the stale shell tool for about 27 minutes, until the explicit /background request.
Screenshot and/or share link
Unavailable: the affected session is private. API state was captured above.
Operating System
Windows 11, build 10.0.26200.9168, x64
Terminal
TUI with TERM=xterm-256color; terminal application unavailable from the environment. Shell: PowerShell 7.6.5 (ComSpec=C:\WINDOWS\system32\cmd.exe).
Activity
github-actions commentedon Aug 21, 2026
This issue might be a duplicate of existing issues. Please check:
Start-Processwith-RedirectStandardOutput/-RedirectStandardErroron Windows #37838: Bash tool hangs indefinitely when PowerShell usesStart-Processwith-RedirectStandardOutput/-RedirectStandardErroron Windows — same root cause (detached Windows process viaStart-Processkeeps the shell tool stuck inrunningstate)If your issue is specifically about the parent session remaining stuck even after the direct shell process exits (rather than a timeout/pipe issue), it may be a distinct bug — please clarify if any of the above match your situation.
pascalandr commentedon Aug 21, 2026
Thanks. #37838 matches the trigger and primary shell hang, so this is likely the same process/pipe bug persisting in V2 rather than a distinct root cause.
This report adds V2-specific downstream behavior and recovery observed on
0.0.0-beta-17793:pwshprocess was gone and the detached GUI remained healthy, but the outer shell tool and parent session still reportedrunning./api/session/active.POST /api/session/{parent}/backgroundimmediately settled the outer tool, preserved the detached GUI process, drained the inbox, and resumed the parent.The failure has occurred twice. Please treat this as a V2 confirmation/duplicate of #37838 if appropriate; the additional value here is the V2 inbox/subagent impact and the non-destructive
/backgroundrecovery path.