Surface cross-workspace subagents in their workspaces (#2061)

* fix(workspaces): show provider subagent activity

Provider subagent lifecycle lives outside managed agent snapshots, so workspace aggregation dropped it after the parent turn finished. Count running provider subagents against the delegation root and emit workspace updates when their status changes.

* fix(workspaces): surface cross-workspace subagents
This commit is contained in:
Mohamed Boudra
2026-07-14 14:22:14 +02:00
committed by GitHub
parent c0b801b805
commit 1f5283f5a3
14 changed files with 295 additions and 38 deletions
@@ -1,5 +0,0 @@
import type { Agent } from "@/stores/session-store";
export function shouldAutoOpenAgentTab(agent: Pick<Agent, "parentAgentId">): boolean {
return !agent.parentAgentId;
}
+1 -1
View File
@@ -3,4 +3,4 @@ export { selectSubagentsForParent, useSubagentsForParent } from "./select";
export { useArchiveSubagent, type UseArchiveSubagentInput } from "./use-archive-subagent";
export { useDetachSubagent, type UseDetachSubagentInput } from "./use-detach-subagent";
export { resolveCloseAgentTabPolicy, type CloseAgentTabPolicy } from "./close-tab-policy";
export { shouldAutoOpenAgentTab } from "./auto-open-tab-policy";
export { isWorkspaceRootAgent } from "./workspace-root-policy";
+1 -1
View File
@@ -6,4 +6,4 @@
// UI surface. Use `@/subagents/policies` only when the caller is
// non-RN infrastructure code; otherwise prefer `@/subagents`.
export { resolveCloseAgentTabPolicy, type CloseAgentTabPolicy } from "./close-tab-policy";
export { shouldAutoOpenAgentTab } from "./auto-open-tab-policy";
export { isWorkspaceRootAgent } from "./workspace-root-policy";
@@ -0,0 +1,17 @@
import type { Agent } from "@/stores/session-store";
import { normalizeWorkspaceOpaqueId } from "@/utils/workspace-identity";
type WorkspaceAgent = Pick<Agent, "parentAgentId" | "workspaceId">;
export function isWorkspaceRootAgent(
agent: WorkspaceAgent,
parentAgent: Pick<Agent, "workspaceId"> | undefined,
): boolean {
if (!agent.parentAgentId) {
return true;
}
const workspaceId = normalizeWorkspaceOpaqueId(agent.workspaceId);
const parentWorkspaceId = normalizeWorkspaceOpaqueId(parentAgent?.workspaceId);
return Boolean(workspaceId && parentWorkspaceId && workspaceId !== parentWorkspaceId);
}