Repository navigation
Description
[Bug] TUI worker terminated when clicking subagent task during parallel multi-task execution
Description
When using oh-my-openagent plugin with parallel multi-task execution, clicking on a subagent task to view its details causes the TUI to display "Worker is terminated" and all running parallel subagent tasks are aborted simultaneously.
This appears to be a TUI worker lifecycle management issue when handling concurrent subagent sessions. The error message "Worker has been terminated" is found in the opencode binary itself (confirmed via strings analysis), indicating an internal worker thread crash/termination.
Key Evidence from Logs
At timestamp 2026-05-14T01:37:05, when clicking a subagent task, the following cascade occurs:
- LSP client initialization fails (likely a side effect of worker disruption):
ERROR service=lsp.client serverID=remark-language-server error=Cannot call write after a stream was destroyed initialize error
ERROR service=lsp error=LSPInitializeError Caused by: Cannot call write after a stream was destroyed Failed to initialize LSP client remark-language-server
- All 5 parallel subagent sessions are simultaneously cancelled:
INFO service=session.prompt session.id=ses_1dbdece80ffeOH4FokfxNd0B7V logSpan.http.span.247=0ms cancel
INFO service=session.prompt session.id=ses_1dbdec707ffe1mykGQLg1rhL5T logSpan.http.span.248=1ms cancel
INFO service=session.prompt session.id=ses_1dbdec018ffe9FBz0wyPKuHuEJ logSpan.http.span.249=0ms cancel
INFO service=session.prompt session.id=ses_1dbdeb8e3ffeCqOd6a8ofQP2Ni logSpan.http.span.250=1ms cancel
INFO service=session.prompt session.id=ses_1dbdeb11bffed4f1JYrbejeP14 logSpan.http.span.251=0ms cancel
- Multiple "Aborted process" errors on one of the subagent sessions:
ERROR service=session.processor session.id=ses_1dbdece80ffeOH4FokfxNd0B7V messageID=msg_e242154ea001HbPOoPdt0NmmLO error=Aborted process
ERROR service=session.processor session.id=ses_1dbdece80ffeOH4FokfxNd0B7V messageID=msg_e242154ea001HbPOoPdt0NmmLO error=Aborted process
ERROR service=session.processor session.id=ses_1dbdece80ffeOH4FokfxNd0B7V messageID=msg_e242154ea001HbPOoPdt0NmmLO error=Aborted process
ERROR service=session.processor session.id=ses_1dbdece80ffeOH4FokfxNd0B7V messageID=msg_e242154ea001HbPOoPdt0NmmLO error=Aborted process
ERROR service=session.processor session.id=ses_1dbdece80ffeOH4FokfxNd0B7V messageID=msg_e242154ea001HbPOoPdt0NmmLO error=Aborted process
- Sessions receive abort requests:
INFO service=default http.method=POST http.url=/session/ses_1dbdece80ffeOH4FokfxNd0B7V/abort http.status=200
INFO service=default http.method=POST http.url=/session/ses_1dbdec707ffe1mykGQLg1rhL5T/abort http.status=200
INFO service=default http.method=POST http.url=/session/ses_1dbdec018ffe9FBz0wyPKuHuEJ/abort http.status=200
Root Cause Hypothesis
Based on log analysis and related issues, the problem appears to be in the TUI worker thread management (/$bunfs/root/src/cli/cmd/tui/worker.js):
- When navigating to a subagent session view, the TUI attempts to load that session's content in a worker thread
- During parallel multi-task execution, this worker creation/switch triggers a race condition or resource conflict
- The worker is unexpectedly terminated, causing a cascade that aborts all related subagent sessions
- Cleanup code is skipped when
validateSessionthrows (as noted in terminal stuck after passing non-existent session ID to opencode -s #23981)
Steps to Reproduce
- Start opencode TUI with oh-my-openagent plugin installed
- Initiate a task that spawns multiple subagents in parallel (e.g., using
task()withrun_in_background=trueor concurrentdelegate_taskcalls) - Wait for 3-5 subagents to be running simultaneously
- Click on one of the running subagent tasks in the TUI to view its session details
- Observe that:
- TUI shows "Worker is terminated" error
- All parallel subagent tasks are aborted
- Main session may also become unresponsive
Expected Behavior
- Clicking a subagent task should navigate to that session's view without affecting other running tasks
- Parallel subagent tasks should continue running independently
- Worker threads should handle session navigation gracefully without termination
Actual Behavior
- TUI displays "Worker is terminated" error
- All parallel subagent sessions are simultaneously cancelled and aborted
- Work in progress is lost
- User must restart the main task
Related Issues
- [Bug] TUI crashes with "Unknown data message" when parsing concurrent tool calls from MiniMax-M2.7 #19463 -
[Bug] TUI crashes with "Unknown data message" when parsing concurrent tool calls- Similar worker.js crash during parallel subagent execution - Random TUI freeze/hang with process continuing in background #12834 -
Random TUI freeze/hang with process continuing in background- Worker thread communication failure with stack traces pointing tocancelfunction in worker.js - terminal stuck after passing non-existent session ID to opencode -s #23981 -
terminal stuck after passing non-existent session ID- "worker isn't terminated when validateSession throws, because the return in the catch path skips cleanup in thread" - Shell/session interrupt regression in 1.4.2 can leave TUI stuck and shutdown timing out #21743 -
Shell/session interrupt regression in 1.4.2 can leave TUI...- "worker shutdown failed; downgrading to 1.3.17 fixes it" - [FEATURE]: Recovery path for errored subagent sessions (composer lockout blocks manual continuation after provider failures) #21525 -
[FEATURE]: Recovery path for errored subagent sessions- Documents that aborting main session loses all in-flight parallel subagent work - [Bug] Task tool loses session ID (task_id) when sub-agent fails or is cancelled — primary agent cannot recover #13910 -
[Bug] Task tool loses session ID when sub-agent fails or is cancelled- Related to subagent cancellation handling
Environment
- OpenCode version: 1.14.49
- Plugin: oh-my-openagent (latest)
- OS: Linux (Ubuntu 24.04 / Debian-based)
- Terminal: GNOME Terminal / Tilix
- Shell: bash
- Installation: npm via nvm (Node.js v24.12.0)
Additional Context
Binary Analysis
The error message "Worker has been terminated" is present in the opencode binary:
$ strings /path/to/opencode-ai/bin/.opencode | grep "Worker has been terminated"
Worker has been terminatedLog File
Full log available at: ~/.local/share/opencode/log/2026-05-14T013613.log
Workaround
Currently, the only workaround is to avoid clicking on subagent tasks while parallel tasks are running. Users must wait for all parallel tasks to complete before viewing individual subagent results, or check progress via background_output tool instead of the TUI.
Impact
This bug makes parallel multi-agent workflows unreliable in the TUI, forcing users to either:
- Use sequential task execution (slower)
- Avoid viewing task details during execution (poor UX)
- Risk losing all in-flight work if accidentally clicking a task
Labels suggestion: bug, tui, worker, subagent, parallel-execution
Activity
github-actions commentedon May 14, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon May 14, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.