Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): preserve failed-start error attention
Dash3dc6a49a110d
diff --git a/apps/desktop/src/renderer/__tests__/useSessionRunningStatusSilence.test.ts b/apps/desktop/src/renderer/__tests__/useSessionRunningStatusSilence.test.tsindex 5ca6b82128..70fa348617 100644--- a/apps/desktop/src/renderer/__tests__/useSessionRunningStatusSilence.test.ts+++ b/apps/desktop/src/renderer/__tests__/useSessionRunningStatusSilence.test.ts@@ -407,6 +407,37 @@ describe('useSessionRunningStatus silenced completion handling', () => {expect(onSessionDone).toHaveBeenCalledTimes(1);});+ it('restores deferred attention as error when the attempted start fails terminally', async () => {+ vi.useFakeTimers();+ const onSessionDone = vi.fn();+ const { rerender } = renderHook(() => useSessionRunningStatus(undefined, { onSessionDone }));++ await emitSnapshot(new Map([['session-terminal-start-failure', status(true)]]));+ await emitSnapshot(new Map([['session-terminal-start-failure', status(false)]]));+ startingMock.sessionIds.add('session-terminal-start-failure');+ await act(async () => {+ await vi.advanceTimersByTimeAsync(500);+ });+ expect(vi.mocked(addSessionAttention)).not.toHaveBeenCalledWith(+ 'session-terminal-start-failure',+ 'done',+ );++ storeMock.terminalErrorSessions.add('session-terminal-start-failure');+ startingMock.sessionIds = new Set();+ rerender();++ expect(vi.mocked(addSessionAttention)).toHaveBeenCalledWith(+ 'session-terminal-start-failure',+ 'error',+ );+ expect(vi.mocked(addSessionAttention)).not.toHaveBeenCalledWith(+ 'session-terminal-start-failure',+ 'done',+ );+ expect(onSessionDone).toHaveBeenCalledTimes(1);+ });+it('drops deferred done attention when starting becomes a real run', async () => {vi.useFakeTimers();const onSessionDone = vi.fn();diff --git a/apps/desktop/src/renderer/hooks/useSessionRunningStatus.ts b/apps/desktop/src/renderer/hooks/useSessionRunningStatus.tsindex 1456827c52..6574b89c87 100644--- a/apps/desktop/src/renderer/hooks/useSessionRunningStatus.ts+++ b/apps/desktop/src/renderer/hooks/useSessionRunningStatus.ts@@ -164,9 +164,18 @@ export function useSessionRunningStatus(// 期间因此抑制了上一轮 done,starting 清除后必须按当前权威状态收口。for (const sessionId of pendingStartingDoneAttentionRef.current) {const cur = statusMap.get(sessionId);+ const hasError = makerChatStore.hasSessionTerminalError(sessionId);const isActive = sessionId === activeSessionId;const isRunning = cur?.isRunning === true;const stillPending = hasPendingInteraction(cur);+ // 启动失败可能从未进入 running,因此不会再有 running→stopped 转换来把+ // deferred done 升级成 error。权威终止错误一旦存在就立即收口为红点,+ // 也不受 active / starting 抑制(done 才有「正在看就不亮」语义)。+ if (hasError) {+ pendingStartingDoneAttentionRef.current.delete(sessionId);+ addSessionAttention(sessionId, 'error');+ continue;+ }if (isActive || isRunning || stillPending) {pendingStartingDoneAttentionRef.current.delete(sessionId);continue;