Vectrum
Sign In

Mirrored subagent threads stay out of a client's sidebar

A host's thread list didn't say which threads were subagents, so a
connected device listed them as ordinary threads. The summary now
carries the delegating thread, and the mirror leaves the result's
delivery to the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JjohannSocommitted 1 parent 6ec9d8fcommitc87edf1

Showing 3 changed files with 12 additions and 0 deletions.

+3−0src/remote/mod.rsView File
@@ -59,6 +59,9 @@ pub struct ThreadSummary {
5959 pub total_cost: f64,
6060 /// Whether anything was sent in it yet.
6161 pub has_items: bool,
62+ /// For a subagent's thread, the thread that delegated its task.
63+ #[serde(skip_serializing_if = "Option::is_none")]
64+ pub parent: Option<String>,
6265 }
6366
6467 /// The rest of an open thread's state, sent with its transcript.
+5−0src/session.rsView File
@@ -4521,6 +4521,10 @@ impl Session {
45214521 if let Some(remote) = self.remote.as_mut() {
45224522 remote.attention = summary.attention;
45234523 }
4524+ // The host hands the task's result over; the mirror only stays out
4525+ // of the sidebar.
4526+ self.delegation =
4527+ summary.parent.clone().map(|parent| Delegation { parent, delivered: true, cancelled: false });
45244528 }
45254529
45264530 /// Takes a host's update of a subscribed thread: its state, and its
@@ -4619,6 +4623,7 @@ impl Session {
46194623 branch: self.worktree.as_ref().map(|worktree| worktree.branch.clone()),
46204624 total_cost: self.total_cost,
46214625 has_items: !self.items.is_empty(),
4626+ parent: self.delegation.as_ref().map(|delegation| delegation.parent.clone()),
46224627 }
46234628 }
46244629
+4−0src/ui/workspace/delegation.rsView File
@@ -357,6 +357,10 @@ impl Workspace {
357357 /// done, hands the result over.
358358 pub(super) fn track_delegation(&mut self, child: &Entity<Session>, cx: &mut Context<Self>) {
359359 let state = child.read(cx);
360+ // A mirrored subagent's host keeps its parent current.
361+ if state.remote.is_some() {
362+ return;
363+ }
360364 let Some(delegation) = state.delegation.clone() else { return };
361365 let task_state = TaskState::of(state);
362366 let task = state.id.clone();