Delegated subagents appear as separate sidebar chats instead of inside the chat that spawned them

Author: JaimeMarquesCreated Sep 26, 2026Updated Sep 26, 2026

What happens

When the agent delegates work with delegate_task, the desktop shows the fan-out as new chats in the sidebar and shows nothing about it in the chat that started it.

Two things combine:

  1. Child sessions are listed as ordinary conversations. listSessions() (src/main/sessions.ts) selects every row from sessions ordered by started_at, with no parent_session_id and no source filter. Each subagent writes its own session row (the spawning agent sets parent_session_id), so every worker shows up as its own sidebar chat that the user has to open, read and clean up. On my own state.db that is 1883 rows with a non-null parent_session_id.
  2. The chat that spawned the subagents renders nothing about them. The gateway already relays a child's activity to the parent session as subagent.* events (subagent.start, subagent.progress, subagent.thinking, subagent.tool, subagent.complete) on the parent's runtime session id, and serves subagent.list / subagent.steer / subagent.interrupt / subagent.tail over the same /api/ws transport the app's chat already uses. applyDashboardStreamEvent has no case for those events, so they are dropped and the parent chat stays silent while its children work.

What it should be

A delegated child belongs to the turn that spawned it: the parent chat should show what it is running (goal, elapsed time, latest activity), let the user expand a child to see its output and steer or stop it, and the child should not be a separate top-level conversation.

Evidence from a live run

Driving a delegate_task fan-out through the same launch path the app uses (hermes dashboard --no-open + /api/ws) — the relayed frames arrive on the parent session id, with the fields a roster needs:

json
{"type":"subagent.start","session_id":"484ef7cb","payload":{"subagent_id":"sa-0-c6a08df3","goal":"Run ... `echo alpha` ...","task_index":0,"task_count":2,"child_session_id":"20260926_025109_9d7b56","delegation_id":"deleg_fe8cf13c","model":"...","depth":0,"tool_count":0,"text":"Run ..."}}
{"type":"subagent.tool","session_id":"484ef7cb","payload":{"subagent_id":"sa-0-c6a08df3","tool_name":"terminal","tool_preview":"echo alpha","tool_count":1,...}}

and the RPCs answer on that transport:

subagent.list  -> {"subagents":[{"subagent_id":"sa-0-c6a08df3","goal":"...","started_at":1790387469.7,"status":"running","tool_count":1,"last_tool":"terminal","accepting_steer":true}],...}
subagent.tail  -> {"available":true,"text":"=== Hermes subagent live transcript ===",...}
subagent.steer -> {"status":"queued","subagent_id":"sa-0-c6a08df3","text":"probe"}

Note subagent.text is intentionally not relayed to the parent, so a parent-side stream is built from tool/progress/thinking lines.

Proposed fix

Two focused changes:

  1. In-chat roster (PR: #) — intercept subagent.* events before the message-stream adapter, project them into rows keyed by the conversation, render live children above the composer with an expandable stream and steer/stop controls, and hydrate from subagent.list for windows opened mid-run.
  2. Sidebar hygiene — keep child sessions (parent_session_id IS NOT NULL) out of the session list, so a conversation list stays a list of conversations (follow-up PR).