Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(orca): guard 跟随「缺失 Worker 即撤销」的新契约

Zhang Yunjin8104867a052b
diff --git a/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts b/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts
index e24d8be1b7..b6204593b1 100644
--- a/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts
+++ b/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts
@@ -285,7 +285,10 @@ describe('sendToSession ordering', () => {
expect(serviceDispatchBlock).toContain('onAcceptedCommit: commitAccepted,');
expect(serviceDispatchBlock).toContain('const currentWorkers = await deps.listWorkersByLead(link.leadSessionId);');
expect(serviceDispatchBlock).toContain('const currentWorker = currentWorkers.find((worker) => worker.id === target.id);');
- expect(serviceDispatchBlock).toContain('previousStatus: currentWorker?.status ?? target.status,');
+ // A worker missing from the active-team list at acceptance is a revocation, not a stale turn;
+ // the snapshot then always carries the live row status.
+ expect(serviceDispatchBlock).toContain("if (!currentWorker) throw new Error('worker no longer belongs to an active team');");
+ expect(serviceDispatchBlock).toContain('previousStatus: currentWorker.status,');
expect(serviceDispatchBlock).toContain('onAcceptedRollback: rollbackAccepted,');
expectOrder(serviceDispatchBlock, 'const currentWorkers = await deps.listWorkersByLead(link.leadSessionId);', "await deps.updateWorkerStatus(target.id, 'running');");
expectOrder(serviceDispatchBlock, 'acceptedSnapshot = {', "await deps.updateWorkerStatus(target.id, 'running');");