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: cover Orca Lead return-home close retry

Praise581c28d3b192
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/sessionAgentSwitchHandler.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/sessionAgentSwitchHandler.test.ts
index 85a4da1384..a6d5479a68 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/sessionAgentSwitchHandler.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/sessionAgentSwitchHandler.test.ts
@@ -1277,6 +1277,21 @@ describe('远程 Agent:选模型时换 Agent 所在电脑', () => {
expect(h.pending.get('s1')).toBeUndefined();
});
+ it('Orca Lead 回到任务电脑时 close 失败后重试本地收尾', async () => {
+ const h = relocationHarness({ orcaRole: 'lead' });
+ vi.mocked(h.deps.closeSession).mockRejectedValueOnce(new Error('offline'));
+
+ await performSessionAgentSwitch(h.deps, backToTaskComputer);
+ await expect(applyPendingAgentSwitchIfIdle(h.deps, 's1')).resolves.toBeUndefined();
+
+ expect(h.deps.closeSession).toHaveBeenCalledTimes(2);
+ expect(h.deps.applyAgentSwitchToDb).toHaveBeenCalledWith('s1', expect.objectContaining({
+ agentDeviceId: null,
+ sdkSessionId: null,
+ }));
+ expect(h.pending.get('s1')).toBeUndefined();
+ });
+
it('挪到另一台电脑:登记前与落地前都按那台的目录校验', async () => {
const h = relocationHarness({ agentDeviceId: null, providerId: 'xd' });
await performSessionAgentSwitch(h.deps, {