feat(desktop): SubAgent 后台会话查看器与思考/工具卡隔离#79
Conversation
新增 archive llmHistory 到 ConversationMessageSnapshot 的转换、setSubagentViewerTarget IPC,并在 buildSnapshot 中注入 subagentViewer。
新增 useSubagentViewer、顶栏 banner、App 消息源切换与 run_subagent 工具卡点击打开查看器。
透传 subagentSessionId 至 pendingToolApproval,提取 PendingApprovalCard,并在查看器内展示匹配的审批 UI。
会话切换、rewind 与 archive 丢失时自动关闭查看器;补充空态文案与 pending 映射单测。
open 在 snapshot 应用后再置 active,避免 auto-close 误关查看器。 主会话与 SubAgent 查看器消息 id 命名空间隔离,切换视图时整表 remount, 防止 Thought 折叠组件因 React key 碰撞逐次堆积。
新增子会话 desktop 消息投影、持久化与查看器消息源解析,使 Thought 与主 Agent timeline 一致;修复 syncPendingToolStates 将子 Agent 审批工具写入主会话,并在委派期间拦截/purge 子工具卡泄漏。
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit db21679. Configure here.
| bundle.messageTimeline.clearSubagentStatusLeak(message.id); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
子代理文本泄漏清理不一致
Medium Severity
本提交为子工具卡泄漏新增了基于 hasInFlightSubagentDelegationInMessages 的清理,但 purgeSubagentLeakTextInCurrentTurn 仍用 hasActiveRunSubagentToolInMessages,且只锚定 preview/running 的 run_subagent。在父级 run_subagent 处于 pending-approval 等阶段时,主会话仍可能残留子智能体状态文本,与工具卡被抑制的行为不一致。
Additional Locations (1)
Reviewed by Cursor Bugbot for commit db21679. Configure here.
| private readonly dreamUpdateListeners = new Set<(snapshot: DesktopSnapshot) => void>(); | ||
| private readonly sessionListUpdateListeners = new Set<() => void>(); | ||
| private readonly sessionTitleGenerationInFlight = new Set<string>(); | ||
| private subagentViewerTargetToolCallId: string | null = null; |
There was a problem hiding this comment.
查看器目标未随会话切换清除
Low Severity
宿主侧 subagentViewerTargetToolCallId 仅由 setSubagentViewerTarget 更新,切换或重置会话时不会自动清空。若渲染端已关闭查看器但 IPC 未完成,或 active 已为 false 而未再发送 null,快照构建仍可能按旧 toolCallId 组装 subagentViewer。
Additional Locations (1)
Reviewed by Cursor Bugbot for commit db21679. Configure here.
purgeSubagentLeakTextInCurrentTurn 与工具行清理共用 hasInFlightSubagentDelegationInMessages 及 pending-approval 锚点;reset/open/delete 会话时清空 subagentViewerTargetToolCallId,避免跨会话残留。


Summary
Test plan