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。

fix(desktop): catch remote Codex recovery failures

yanf3bcc3a11416
diff --git a/apps/desktop/src/main/maker-host/__tests__/remote-codex-mcp-recovery.test.ts b/apps/desktop/src/main/maker-host/__tests__/remote-codex-mcp-recovery.test.ts
index ff70eb58a7..ecb73d88ae 100644
--- a/apps/desktop/src/main/maker-host/__tests__/remote-codex-mcp-recovery.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/remote-codex-mcp-recovery.test.ts
@@ -130,6 +130,18 @@ describe('refreshRemoteCodexMcpAfterBridgeRecreate', () => {
);
});
});
+
+ it('logs and absorbs unexpected ensure rejections', async () => {
+ ensureMock.mockRejectedValue(new Error('ssh closed'));
+ const { deps, warn } = makeDeps({ listRemoteCodexHostIds: () => ['host-a'] });
+ refreshRemoteCodexMcpAfterBridgeRecreate(deps);
+ await vi.waitFor(() => {
+ expect(warn).toHaveBeenCalledWith(
+ 'remote MCP recovery after bridge recreate threw',
+ expect.objectContaining({ hostId: 'host-a', reason: 'ssh closed' }),
+ );
+ });
+ });
});
describe('invalidateRemoteCcQueriesForMcpGenerationChange', () => {
diff --git a/apps/desktop/src/main/maker-host/remote-codex-mcp-recovery.ts b/apps/desktop/src/main/maker-host/remote-codex-mcp-recovery.ts
index 539b0c591f..2bfcc28cd5 100644
--- a/apps/desktop/src/main/maker-host/remote-codex-mcp-recovery.ts
+++ b/apps/desktop/src/main/maker-host/remote-codex-mcp-recovery.ts
@@ -69,6 +69,11 @@ export function refreshRemoteCodexMcpAfterBridgeRecreate(deps: RemoteCodexMcpRec
if (result.daemonRebootstrapped && !liveTurnChecker(hostId)) {
deps.detachRemoteCodexSessionsOnHost(hostId);
}
+ }).catch((err) => {
+ deps.log.warn('remote MCP recovery after bridge recreate threw', {
+ hostId,
+ reason: err instanceof Error ? err.message : String(err),
+ });
});
}
}