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
Interrupting the main agent does not stop background subagents #28738
When using experimental native background subagents, manually interrupting the main agent does not appear to stop the background subagent.
For example, if a background task is running and I click the UI interrupt/stop control, or press Esc to interrupt the main agent, the main agent stops but the background subagent continues running.
I found related issues like #21176 and #13916, but this report is narrower: it is about the current task(background=true) behavior when the user manually interrupts the parent/main agent.
Plugins
No plugin is required for this behavior. This appears to be on the native background subagent path; plugins do not appear to affect the repro.
OpenCode version
1.15.6
Steps to reproduce
Enable experimental native background subagents.
Start a background subagent with task(background=true).
While the background subagent is still running, interrupt the main agent from the UI stop/interrupt control or by pressing Esc.
Observe that the main agent is interrupted, but the background subagent continues running.
Expected: one of these behaviors would make the lifecycle clearer:
A. Interrupting the main agent also cancels its running background subagents.
B. The main agent has an explicit tool/control to cancel a running background subagent by task id.
This issue might be a duplicate of existing issues. Please check:
[sub-agents] Agents not killed on cancel #23534: "[sub-agents] Agents not killed on cancel" — reports the same behavior where subagents continue running after the parent session/agent is cancelled/interrupted.
I checked #23534. It looks related, but I don't think it is the same repro.
#23534 was reported on OpenCode 1.14.19 with an external plugin. In v1.14.19, the native task tool did not yet expose the background parameter, and task_status was not present.
This issue is specifically about the experimental native background subagent path in 1.15.6: task(background=true) / task_status. When the parent/main agent is interrupted via UI stop or Esc, the native background task keeps running.
Related: The only way I've found to kill background tasks (besides exiting opencode) is to make an API call to /session/:id/abort with the task_id. The model has no knowledge of that path nor the port.
Activity
github-actions commentedon May 21, 2026
This issue might be a duplicate of existing issues. Please check:
wanyaoluo commentedon May 21, 2026
I checked #23534. It looks related, but I don't think it is the same repro.
#23534 was reported on OpenCode 1.14.19 with an external plugin. In v1.14.19, the native task tool did not yet expose the
backgroundparameter, andtask_statuswas not present.This issue is specifically about the experimental native background subagent path in 1.15.6:
task(background=true)/task_status. When the parent/main agent is interrupted via UI stop or Esc, the native background task keeps running.jamesjmartin commentedon May 22, 2026
I believe this is due to the abort path in packages/opencode/src/session/run-state.ts killing the background wrapper fiber, but not the child session runner.
Related: The only way I've found to kill background tasks (besides exiting opencode) is to make an API call to /session/:id/abort with the task_id. The model has no knowledge of that path nor the port.
github-actions commentedon Jul 22, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
MatteoGauthier commentedon Sep 24, 2026
Just tested today with OpenCode Desktop
Version 2.0.16 (2.0.16).Subagents aren't stopped when the main session is interrupted. Also, I think it would be nice to have a way to stop the subagents or subsessions.