Skip to content

Desktop: running-subagents indicator never shows nested subagents (subagent_depth > 1) #58489

Open

Description

@Redaudacious

Description

Summary

With experimental.subagent_depth: 2, nested subagents (a subagent started by a subagent) never appear in the "N working" indicator at the top of the session view. They don't show up in the root session, and they don't show up in the child session that started them. The only way to reach one is to open the child session and click the subagent tool row in its transcript.

Environment

  • OpenCode Desktop 2.1.4, Linux (.deb)
  • opencode.json: "experimental": { "subagent_depth": 2 }

Steps to reproduce

  1. Define three agents in .opencode/agents/:
    • a.md: mode: primary, allowed to call subagent b; prompt: "Call subagent b."
    • b.md: mode: all, allowed to call subagent c; prompt: "Call subagent c."
    • c.md: mode: subagent; prompt: "Reply with DONE." (make it slow enough to watch, e.g. ask it to run sleep 30 first)
  2. Start a session with agent a.
  3. While c is running, look at the "working" indicator in session a, then open session b and look at its indicator.

Expected

  • In session b, the indicator lists c (it is b's running subagent).
  • Ideally, session a also shows that work is running below b.

Actual

  • Session a lists only b.
  • Session b also lists only b (itself and its siblings), never c.
  • c is only reachable by opening b and clicking the tool row.

The sessions are linked correctly: in opencode.db, session_v2.parent_id of c is b, and of b is a. This is only a UI issue.

Cause (from the 2.1.4 desktop bundle)

The running-work state resolves the session to read from like this:

const target = session.get(id)?.parentID ?? id

Then it collects running subagent tool parts only from target's messages. That works for depth 1: in a child session, you see the parent's children, meaning yourself and your siblings. With depth 2 it breaks. Inside b, target becomes a, so b's own running subagents are never read. And a's messages never contain c.

Suggested fix

One of these would work:

  1. Read the open session itself (target = id), so each session lists its own running subagents. Maybe keep siblings via the parent as a second source.
  2. Better: collect running subagents from the whole family below the root, using the existing session.family(root), and show nested ones indented under their parent.

Option 2 also makes the root session show everything that is running, which helps when a delegating agent runs an orchestrator that runs workers.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot

No response

Operating System

No response

Terminal

No response

Activity

  1. opencode-agent commented on Oct 23, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up and for tracking down the cause.

    You're asking for the "N working" header to show nested subagents: a child session would list its own running subagents, and ideally the root would show everything running in the session tree, with nested items indented under their parent.

    Your reading of the code is right. The header was built for one level of subagents: inside a child session it lists the parent's running work (the child and its siblings), and the root only scans its direct children. Nested subagents (experimental.subagent_depth > 1) are still experimental, and the header was never extended to cover them. So I've filed this as a feature request rather than a bug. Maintainers will consider it; both of your suggested approaches, especially collecting work across the whole family under the root, are useful input.

    A plugin can't do this for now, because plugins can't change the Desktop session header.

    Related issues:

  2. FaheemOnHub commented on Oct 27, 2026

    @FaheemOnHub

    i reproduced this and tested a local implementation with a->b->c/

    The proposed behavior is:

    • A lists B and C, with C indented beneath B.
    • B lists only C.
    • Entries open the correct sessions, and counts update as workers finish.

    before:

    Image Image

    after:

    Image Image

    would maintainers approve this approach for an implementation PR? @opencode-agent

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

Metadata

Metadata

Assignees

No one assigned

    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