Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(orca): 运行时恢复提示不再进入 Worker 兜底结果捕获
ficowang305b5c88f847
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/sessionEventPipeline.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/sessionEventPipeline.test.tsindex c475a11c95..2e7b9e3653 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/sessionEventPipeline.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/sessionEventPipeline.test.ts@@ -419,6 +419,22 @@ describe('production Session event pipeline', () => {await h.dispose();});+ // #4349: the Host recovery notice reaches Desktop through the dedicated+ // onRuntimeRecovery channel but shares handleSessionEvent with turn text. It is+ // persisted and broadcast, yet must not be captured as an Orca worker result.+ it('keeps a Host runtime-recovery notice out of Orca worker capture while still persisting it', async () => {+ const h = harness();+ const data = { isFinal: true, text: 'restart-cindy-to-refresh-packages' };+ h.emit(event('text', data, { source: 'pi', runtimeRecovery: true }));+ expect(h.deps.orcaTeamServiceForEvents.captureWorkerText).not.toHaveBeenCalled();+ // Still persisted (with the localized notice text) for the transcript.+ expect(effects.fn('onAssistantTextEvent')).toHaveBeenCalledOnce();+ // Ordinary worker text is still captured.+ h.emit(event('text', { isFinal: true, text: 'real worker reply' }, { source: 'pi' }));+ expect(h.deps.orcaTeamServiceForEvents.captureWorkerText).toHaveBeenCalledWith('task', 'real worker reply', { isFinal: true });+ await h.dispose();+ });+it('preserves ordinary Pi text without the Host recovery marker', async () => {const h = harness();const data = { isFinal: true, text: 'partial: restart-cindy-to-refresh-packages' };diff --git a/apps/desktop/src/main/maker-ipc/sessionEventStream.ts b/apps/desktop/src/main/maker-ipc/sessionEventStream.tsindex 05909f00ba..e6af9c5117 100644--- a/apps/desktop/src/main/maker-ipc/sessionEventStream.ts+++ b/apps/desktop/src/main/maker-ipc/sessionEventStream.ts@@ -34,7 +34,11 @@ export function persistSessionStreamEvent(let resolvedContent: string | undefined;if (event.type === 'text') {const td = event.data as { text?: unknown; isFinal?: unknown; isFullText?: unknown } | null;- if (typeof td?.text === 'string') {+ // A Host runtime-recovery notice (#4349) is not the worker's reply: it is+ // persisted and broadcast like any assistant text below, but must never be+ // captured as an Orca worker result. Otherwise an error terminal that lacks+ // finalText could fall back to the localized recovery prompt as the "result".+ if (typeof td?.text === 'string' && event.runtimeRecovery !== true) {deps.orcaTeamServiceForEvents?.captureWorkerText(session.id, td.text, {isFinal: td.isFinal === true,});