Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(handoff): keep create broadcast guard independent of dispatch nesting
Chris24ab2e3b89ba
diff --git a/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts b/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.tsindex c86ed73627..499f723102 100644--- a/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts+++ b/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts@@ -513,13 +513,20 @@ describe('sendToSession ordering', () => {'if (!targetSessionId) {','const prev = sendToSessionLocks.get(targetSessionId);',);- const acceptedBlock = extractBetween(+ // Verified relays use the durable queue (behavior-covered by+ // sendToSessionLazyResumePermission); inspect the remaining direct-send+ // contract without depending on its nesting indentation.+ const sendCall = extractBetween(createBranch,+ 'const sendResult = await sendUserMessageWithAwaitedGitBaseline(',+ '}, directSource);',+ );+ const acceptedBlock = extractBetween(+ sendCall,'onAccepted: async () => {',- ' },\n onDispatching:',+ 'onDispatching:',);- const sendCallEndNeedle =- ' onDispatching: () => dispatchAgentIslandUserPrompt(session.id),\n }, directSource);';+ const sendCallEndNeedle = '}, directSource);';const afterSendResolves = createBranch.slice(createBranch.indexOf(sendCallEndNeedle) + sendCallEndNeedle.length,);@@ -530,7 +537,7 @@ describe('sendToSession ordering', () => {expectOrder(acceptedBlock, 'notifyAgentIslandUserPrompt(session, persistedContent ?? message, {', 'await createDbMessage(session.id, {');expectOrder(acceptedBlock, 'await createDbMessage(session.id, {', 'broadcastSessionCreated(session.id);');expect(afterSendResolves).not.toContain('broadcastSessionCreated(session.id);');- expect(countOccurrences(createBranch, 'broadcastSessionCreated(session.id);')).toBe(1);+ expect(countOccurrences(sendCall, 'broadcastSessionCreated(session.id);')).toBe(1);});it('routes ANY_SESSION_IN_TURN through maker active session state', () => {diff --git a/apps/desktop/src/main/maker-ipc/__tests__/sendToSessionLazyResumePermission.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/sendToSessionLazyResumePermission.test.tsindex faea9e2756..55567ee67d 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/sendToSessionLazyResumePermission.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/sendToSessionLazyResumePermission.test.ts@@ -404,6 +404,7 @@ describe('idle forwarded request authorization', () => {expect(enqueue).toHaveBeenCalledWith(expect.objectContaining({ targetSessionId: 'new-child', autoReviewUserText: receipt }));expect(h.sendOptions).toHaveLength(0);expect(broadcast).toHaveBeenCalledWith('new-child');+ expect(broadcast).toHaveBeenCalledTimes(1);});it.each([['live', 'agent-request'], ['resumed', 'agent-request'],