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(bots): align internal dispatch ordering guard

Chris731c93313497
diff --git a/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts b/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts
index b67f7ae133..e24d8be1b7 100644
--- a/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts
+++ b/apps/desktop/src/main/__tests__/makerSendToSessionOrdering.test.ts
@@ -346,6 +346,10 @@ describe('sendToSession ordering', () => {
});
it('does not let persisted sends ignore typed dispatch outcomes', () => {
+ // #6895: the final demotion fence now wraps the same dispatch notification.
+ // Keep the existing accepted/dispatch contract, including the callback body.
+ const dispatchCallback = extractBetween(source, 'const onInternalDispatching = () => {', '\n if (targetSessionId) {');
+ expect(dispatchCallback).toContain('dispatchAgentIslandUserPrompt(targetSessionId!);');
const helperBlock = extractBetween(
orcaInterAgentDispatcherSource,
'async function sendPersistedUserMessageToSession',
@@ -391,13 +395,13 @@ describe('sendToSession ordering', () => {
expect(liveBranch).toContain('live,');
expectOrder(liveBranch, 'message,', 'clientId,');
expect(liveBranch).toContain('onAccepted: persistUserMessage,');
- expect(liveBranch).toContain('onDispatching: () => dispatchAgentIslandUserPrompt(targetSessionId),');
+ expect(liveBranch).toContain('onDispatching: onInternalDispatching,');
expect(liveBranch).toContain("assertDesktopSendDispatched(sendResult, 'send_to_session live');");
expect(resumedBranch).toContain('const sendResult = await sendUserMessageWithAwaitedGitBaseline(');
expect(resumedBranch).toContain('session,');
expectOrder(resumedBranch, 'message,', 'clientId,');
expect(resumedBranch).toContain('onAccepted: persistUserMessage,');
- expect(resumedBranch).toContain('onDispatching: () => dispatchAgentIslandUserPrompt(targetSessionId),');
+ expect(resumedBranch).toContain('onDispatching: onInternalDispatching,');
expect(resumedBranch).toContain("assertDesktopSendDispatched(sendResult, 'send_to_session resumed');");
});
@@ -734,7 +738,7 @@ describe('sendToSession ordering', () => {
expect(liveBranch).toContain('const sendResult = await sendUserMessageWithAwaitedGitBaseline(');
expect(liveBranch).toContain('live,');
expect(liveBranch).toContain('onAccepted: persistUserMessage,');
- expect(liveBranch).toContain('onDispatching: () => dispatchAgentIslandUserPrompt(targetSessionId),');
+ expect(liveBranch).toContain('onDispatching: onInternalDispatching,');
expect(liveBranch).not.toContain('await persistUserMessage();');
expect(liveBranch).toContain('if (isSessionRunningError(err))');
expect(liveBranch).toContain('await enqueueSendToSessionMessage({');
@@ -752,7 +756,7 @@ describe('sendToSession ordering', () => {
expect(resumedBranch).toContain('const sendResult = await sendUserMessageWithAwaitedGitBaseline(');
expect(resumedBranch).toContain('session,');
expect(resumedBranch).toContain('onAccepted: persistUserMessage,');
- expect(resumedBranch).toContain('onDispatching: () => dispatchAgentIslandUserPrompt(targetSessionId),');
+ expect(resumedBranch).toContain('onDispatching: onInternalDispatching,');
expect(resumedBranch).not.toContain('await persistUserMessage();');
expect(resumedBranch).toContain('if (isSessionRunningError(err))');
expect(resumedBranch).toContain('await enqueueSendToSessionMessage({');