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>
Showing 3 changed files with 12 additions and 0 deletions.
| @@ -59,6 +59,9 @@ pub struct ThreadSummary { | ||
| 59 | 59 | pub total_cost: f64, |
| 60 | 60 | /// Whether anything was sent in it yet. |
| 61 | 61 | 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>, | |
| 62 | 65 | } |
| 63 | 66 | |
| 64 | 67 | /// The rest of an open thread's state, sent with its transcript. |
| @@ -4521,6 +4521,10 @@ impl Session { | ||
| 4521 | 4521 | if let Some(remote) = self.remote.as_mut() { |
| 4522 | 4522 | remote.attention = summary.attention; |
| 4523 | 4523 | } |
| 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 }); | |
| 4524 | 4528 | } |
| 4525 | 4529 | |
| 4526 | 4530 | /// Takes a host's update of a subscribed thread: its state, and its |
| @@ -4619,6 +4623,7 @@ impl Session { | ||
| 4619 | 4623 | branch: self.worktree.as_ref().map(|worktree| worktree.branch.clone()), |
| 4620 | 4624 | total_cost: self.total_cost, |
| 4621 | 4625 | has_items: !self.items.is_empty(), |
| 4626 | + parent: self.delegation.as_ref().map(|delegation| delegation.parent.clone()), | |
| 4622 | 4627 | } |
| 4623 | 4628 | } |
| 4624 | 4629 | |
| @@ -357,6 +357,10 @@ impl Workspace { | ||
| 357 | 357 | /// done, hands the result over. |
| 358 | 358 | pub(super) fn track_delegation(&mut self, child: &Entity<Session>, cx: &mut Context<Self>) { |
| 359 | 359 | let state = child.read(cx); |
| 360 | + // A mirrored subagent's host keeps its parent current. | |
| 361 | + if state.remote.is_some() { | |
| 362 | + return; | |
| 363 | + } | |
| 360 | 364 | let Some(delegation) = state.delegation.clone() else { return }; |
| 361 | 365 | let task_state = TaskState::of(state); |
| 362 | 366 | let task = state.id.clone(); |