Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(desktop,mobile): 纠正断言旧伪造补全行为的存量测试
Kafeifei8021df6236dd
diff --git a/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts b/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.tsindex fa87f2a4e0..64976347fd 100644--- a/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts+++ b/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts@@ -228,6 +228,7 @@ describe('update_plan tool_use persistence', () => {],},terminalPlanSnapshot: true,+ terminalPlanAtMs: expect.any(Number),},);expect(broadcastMessageRow).toHaveBeenCalledWith(@@ -264,6 +265,7 @@ describe('update_plan tool_use persistence', () => {toolName: 'update_plan',input: { plan: openPlan },terminalPlanSnapshot: true,+ terminalPlanAtMs: expect.any(Number),});});@@ -292,6 +294,7 @@ describe('update_plan tool_use persistence', () => {toolName: 'update_plan',input: { plan: [{ step: 'Ship', status: 'completed' }] },terminalPlanSnapshot: true,+ terminalPlanAtMs: expect.any(Number),},);expect(broadcastMessageRow).toHaveBeenCalledWith(diff --git a/apps/desktop/src/renderer/__tests__/planReviewDoneRace.test.ts b/apps/desktop/src/renderer/__tests__/planReviewDoneRace.test.tsindex cebcb55771..3497558963 100644--- a/apps/desktop/src/renderer/__tests__/planReviewDoneRace.test.ts+++ b/apps/desktop/src/renderer/__tests__/planReviewDoneRace.test.ts@@ -275,7 +275,7 @@ describe('plan_review 与 done 的时序', () => {expect(latestPlanStatuses()).toEqual(['in_progress', 'pending']);});- it('codex:成功完成但缺少最终 plan 快照时收口计划卡片', () => {+ it('codex:成功完成但缺少最终 plan 快照时盖章收口、不改步骤事实', () => {const startedAtMs = 1_700_000_000_000;const completedAtMs = startedAtMs + 5_000;const now = vi.spyOn(Date, 'now').mockReturnValue(startedAtMs);@@ -285,13 +285,18 @@ describe('plan_review 与 done 的时序', () => {now.mockReturnValue(completedAtMs);emitDone('codex', undefined, 'turn-1', 'completed');- expect(latestPlanStatuses()).toEqual(['completed', 'completed']);- const completedPlan = makerChatStore+ // 收口 = 终态章(生命周期),步骤保持 agent 实际报告的状态。+ expect(latestPlanStatuses()).toEqual(['in_progress', 'pending']);+ const sealedPlan = makerChatStore.getSnapshot(SESSION_ID).messages.findLast((message) => message.role === 'tool_use' && message.toolName === 'update_plan',);- expect(completedPlan).toMatchObject({ planUpdatedAtMs: completedAtMs });+ expect(sealedPlan).toMatchObject({+ terminalPlanSnapshot: true,+ terminalPlanAtMs: completedAtMs,+ planUpdatedAtMs: completedAtMs,+ });});it('claude:done 不改 Codex update_plan 展示状态', () => {diff --git a/apps/mobile/src/__tests__/remoteSessionStore.test.ts b/apps/mobile/src/__tests__/remoteSessionStore.test.tsindex 5d94f9b1ca..d0d6f0aaef 100644--- a/apps/mobile/src/__tests__/remoteSessionStore.test.ts+++ b/apps/mobile/src/__tests__/remoteSessionStore.test.ts@@ -1053,7 +1053,7 @@ describe('remoteSessionStore', () => {});});- it('keeps synthetic completion when done precedes the initial plan DB row', () => {+ it('keeps the honest live snapshot when done precedes the initial plan DB row', () => {remoteSessionStore.applyRemotePush('dev-1', 'maker:event', {sessionId: 's1',persistId: 'plan-row-1',@@ -1105,17 +1105,19 @@ describe('remoteSessionStore', () => {},});+ // 成功收尾封的是生命周期,不改步骤事实:agent 报告什么就显示什么,+ // 晚到的 DB 行也不能把 live 快照拉回更旧的内容。expect(remoteSessionStore.getMessages('s1')[0].content).toMatchObject({input: {plan: [- { step: 'Inspect', status: 'completed' },- { step: 'Patch', status: 'completed' },+ { step: 'Inspect', status: 'in_progress' },+ { step: 'Patch', status: 'pending' },],},});});- it('does not let a delayed message window revert synthetic completion', () => {+ it('does not let a delayed message window revert the live plan snapshot', () => {const stalePlanRow = {...message('plan-row-1', 's1'),role: 'tool_use' as const,@@ -1153,8 +1155,9 @@ describe('remoteSessionStore', () => {remoteSessionStore.setLatestMessageWindow('s1', [stalePlanRow]);+ // 步骤保持 agent 实际报告的状态,不因成功收尾被改写成 completed。expect(remoteSessionStore.getMessages('s1')[0].content).toMatchObject({- input: { plan: [{ step: 'Inspect', status: 'completed' }] },+ input: { plan: [{ step: 'Inspect', status: 'in_progress' }] },});});