Description
Background subagents (e.g. librarian, explore) that were launched in a previous session context (before compaction or restart) persist in the UI's "Subagentes" panel as running tasks indefinitely. They cannot be cleared.
Steps to Reproduce
- Start a session and launch background subagents (e.g.
task(subagent_type="librarian", run_in_background=true, ...))
- Session gets compacted (context reset) or OpenCode is restarted
- The subagent entries remain visible in the UI sidebar showing "running" state
background_cancel(all=true) returns "No running or pending background tasks to cancel"
- Restarting OpenCode does not clear them
Expected Behavior
- Stale subagent entries should be cleared on session restart or compaction
- Or: provide a CLI command like
opencode session clear-tasks <sessionID> to manually clear them
- Or: the UI should detect orphaned tasks and remove/mark them as stale
Actual Behavior
The UI shows ghost entries forever:
▼ Subagentes
[ ] Research regional MIGs (librarian) ↳ 23:36:01
[ ] Find GCE aggregated machineType… (librarian) ↳ 23:38:48
These are not actually running — they're leftover references from a pre-compaction context that no longer exists.
Environment
- OpenCode version: 0.6.1
- OS: Linux
Description
Background subagents (e.g.
librarian,explore) that were launched in a previous session context (before compaction or restart) persist in the UI's "Subagentes" panel as running tasks indefinitely. They cannot be cleared.Steps to Reproduce
task(subagent_type="librarian", run_in_background=true, ...))background_cancel(all=true)returns "No running or pending background tasks to cancel"Expected Behavior
opencode session clear-tasks <sessionID>to manually clear themActual Behavior
The UI shows ghost entries forever:
These are not actually running — they're leftover references from a pre-compaction context that no longer exists.
Environment