Skip to content

Stale background subagents persist in UI after session restart/compaction #27373

Closed as not planned

Description

@fruch

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

  1. Start a session and launch background subagents (e.g. task(subagent_type="librarian", run_in_background=true, ...))
  2. Session gets compacted (context reset) or OpenCode is restarted
  3. The subagent entries remain visible in the UI sidebar showing "running" state
  4. background_cancel(all=true) returns "No running or pending background tasks to cancel"
  5. 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

Activity

  1. github-actions commented on Jul 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions