Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): clear stale plan ownership on idle reconcile
Kafeifeicb77ac1bee21
diff --git a/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts b/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.tsindex b7b5e01598..489d765277 100644--- a/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts+++ b/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts@@ -128,6 +128,12 @@ describe('maker:event hot path ordering', () => {'sessionTurnActivityTracker.setSessionInTurn(sessionId, false);','notifyGoalIdleAfterTurnSettled(sessionId);',);+ expectOrder(+ reconcileSource,+ 'markTurnEndedAfterPersistDrain(sessionId);',+ 'clearCodexPlanRowsForSession(sessionId);',+ 'resetTurnPersistState(sessionId);',+ );// ABORT_SESSION reconciles from finally, so vendor abort rejection still reaches the// shared idle wake-up once the exact Session/generation boundary proves idle.diff --git a/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts b/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.tsindex 54f321b163..ce06e42551 100644--- a/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts+++ b/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts@@ -70,6 +70,7 @@ import {isSuccessfulCodexDoneEventData,onTurnErrorEvent,resetTurnPersistState,+ clearCodexPlanRowsForSession,clearSessionPersistState,consumeLastAssistantPersistId,consumeLastTopLevelAssistantPersistId,@@ -516,6 +517,25 @@ describe('update_plan tool_use persistence', () => {expect(persistCodexPlanOnTerminalError(SESSION)).toBe(false);});+ it('does not carry a reconciled turn plan into a later id-less terminal error', () => {+ onToolUseEvent(+ SESSION,+ {+ toolUseId: 'plan:turn-reconciled',+ toolName: 'update_plan',+ input: { plan: [{ step: 'Old turn work', status: 'completed' }] },+ },+ null,+ );++ // reconcileSessionTurnIdle treats the lost-terminal path as a logical turn+ // boundary and clears this cross-segment ownership before the next turn.+ clearCodexPlanRowsForSession(SESSION);+ resetTurnPersistState(SESSION);++ expect(persistCodexPlanOnTerminalError(SESSION)).toBe(false);+ });+it('does not dedupe ordinary repeated tool_use ids', async () => {const firstPersistId = onToolUseEvent(SESSION,diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex 09fd9d3698..cf3bbaac92 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -9314,6 +9314,10 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)// The marker write is best-effort and ordered behind pending message// persistence. It may retry/settle after an owner boundary is available.markTurnEndedAfterPersistDrain(sessionId);+ // This is a logical turn boundary even though the vendor terminal event+ // was lost. Drop the cross-segment plan ownership here so a later turn's+ // id-less terminal error cannot fail-stamp an older plan.+ clearCodexPlanRowsForSession(sessionId);resetTurnPersistState(sessionId);noteClaudeSessionTurnState(sessionId, false);settlePendingCredentialSwitch(sessionId, `reconcile:${source}`);