From 888a5241f4f560cf011ee8f6734604116a8faa2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Sat, 1 Aug 2026 12:16:46 +0800 Subject: [PATCH] fix(activity): reconcile stopped agents and task updates --- .../activity/SessionActivityPanel.test.tsx | 36 + .../activity/SessionActivityPanel.tsx | 24 +- .../activity/sessionActivityModel.test.ts | 351 +- .../activity/sessionActivityModel.ts | 69 +- .../src/components/chat/ChatInput.test.tsx | 69 + desktop/src/components/chat/ChatInput.tsx | 18 + .../src/hooks/useKeyboardShortcuts.test.tsx | 114 +- desktop/src/hooks/useKeyboardShortcuts.ts | 15 +- desktop/src/i18n/locales/en.ts | 1 + desktop/src/i18n/locales/jp.ts | 1 + desktop/src/i18n/locales/kr.ts | 1 + desktop/src/i18n/locales/zh-TW.ts | 1 + desktop/src/i18n/locales/zh.ts | 1 + desktop/src/lib/backgroundTasks.test.ts | 27 +- desktop/src/lib/backgroundTasks.ts | 7 + desktop/src/stores/chatStore.test.ts | 1259 +++++++ desktop/src/stores/chatStore.ts | 327 +- src/entrypoints/sdk/coreSchemas.ts | 1 + .../__tests__/conversation-service.test.ts | 89 + .../task-notification-persistence.test.ts | 108 + .../__tests__/websocket-handler.test.ts | 2948 +++++++++++++++++ src/server/services/conversationService.ts | 39 +- src/server/services/sessionService.ts | 191 +- src/server/ws/handler.ts | 1378 +++++++- src/utils/sdkEventQueue.ts | 1 + src/utils/task/framework.test.ts | 47 + src/utils/task/framework.ts | 2 + src/utils/teleport/api.test.ts | 110 + src/utils/teleport/api.ts | 73 +- 29 files changed, 7090 insertions(+), 218 deletions(-) create mode 100644 src/utils/task/framework.test.ts create mode 100644 src/utils/teleport/api.test.ts diff --git a/desktop/src/components/activity/SessionActivityPanel.test.tsx b/desktop/src/components/activity/SessionActivityPanel.test.tsx index e93d1f40..f24518b9 100644 --- a/desktop/src/components/activity/SessionActivityPanel.test.tsx +++ b/desktop/src/components/activity/SessionActivityPanel.test.tsx @@ -52,6 +52,7 @@ vi.mock('../../i18n', () => ({ 'session.activity.status.inProgress': 'In progress', 'session.activity.status.completed': 'Completed', 'session.activity.status.running': 'Running', + 'session.activity.status.stopping': 'Stopping', 'session.activity.status.failed': 'Failed', 'session.activity.status.stopped': 'Stopped', 'session.activity.status.idle': 'Idle', @@ -406,6 +407,41 @@ describe('SessionActivityPanel', () => { expect(screen.queryByRole('button', { name: 'Stop background task Background reviewer' })).not.toBeInTheDocument() }) + it('stops SubAgent motion while a global stop request is settling', () => { + render( + , + ) + + expect(screen.getByText('Stopping')).toBeInTheDocument() + expect(screen.getByTestId('agent-mascot')).toHaveAttribute('data-agent-mascot-motion', 'still') + expect(screen.queryByTestId('agent-mascot-motion-ring')).not.toBeInTheDocument() + }) + it('keeps SubAgent rows to name and status instead of result previews', () => { render( + return } const Icon = getRowIcon(row) @@ -316,6 +324,11 @@ function ActivityRowView({ }) { const t = useTranslation() const isTask = row.section === 'tasks' + const isStoppingSubagent = row.section === 'subagents' && row.status === 'running' && stoppingBackgroundTask + const displayStatus: ActivityRow['status'] = isStoppingSubagent ? 'pending' : row.status + const statusLabel = isStoppingSubagent + ? t('session.activity.status.stopping') + : getActivityStatusLabel(row.status, t) const label = row.taskHistory ? t('session.activity.tasks.earlier') : row.label @@ -335,7 +348,7 @@ function ActivityRowView({ {isTask ? ( ) : ( - + )} {isTask ? null : ( )} @@ -389,7 +402,6 @@ function ActivityRowView({ } if (row.section === 'subagents' && row.openable && row.toolUseId) { - const statusLabel = getActivityStatusLabel(row.status, t) const openButton = (