Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): collab 禁用时摘除 bridge 上的旧 session ctx
yan37e7dfaf8453
diff --git a/apps/desktop/src/main/maker-host/__tests__/cc-remote-mcp.test.ts b/apps/desktop/src/main/maker-host/__tests__/cc-remote-mcp.test.tsindex b063ee5cca..fe4b6ed785 100644--- a/apps/desktop/src/main/maker-host/__tests__/cc-remote-mcp.test.ts+++ b/apps/desktop/src/main/maker-host/__tests__/cc-remote-mcp.test.ts@@ -108,6 +108,29 @@ describe('buildCcRemoteHttpMcpServers', () => {expect(needsFreshStart).toBeFalsy();});+ it('unregisters the stale session ctx when collab is disabled (R26 P2: no leftover auth route)', async () => {+ // 此前注入注册过 ctx 的 session, collab 禁用后 build 必须摘掉它 —+ // 否则 ?session=<id> 的授权路由在禁用后仍可用到 bridge 关闭。+ const { bridge, registered } = fakeBridge();+ registered.set('s-disable', { sessionId: 's-disable', agentKind: 'claude-code', vendorOptions: {} });+ const { servers, fingerprint } = await buildCcRemoteHttpMcpServers(+ { host: HOST, sessionId: 's-disable', workingDir: '/remote/repo' },+ {+ ensureBridgeStarted: async () => ({+ port: 38080,+ serverNames: ['cindy_orca', 'orca_worker_bridge'],+ bridge,+ }),+ ensureForward: vi.fn(async () => 47921),+ getBridgeToken: async () => 'persistent-test-token',+ isCollabEnabled: () => false,+ },+ );+ expect(servers).toEqual({});+ expect(fingerprint).toBe('disabled');+ expect(registered.has('s-disable')).toBe(false); // 旧 ctx 已摘+ });+it('returns a generation fingerprint on successful injection, and the disabled constant when gated off (R23 P2)', async () => {const { bridge } = fakeBridge();const injected = await buildCcRemoteHttpMcpServers(diff --git a/apps/desktop/src/main/maker-host/cc-remote-mcp.ts b/apps/desktop/src/main/maker-host/cc-remote-mcp.tsindex 7c9a956cda..eabe499456 100644--- a/apps/desktop/src/main/maker-host/cc-remote-mcp.ts+++ b/apps/desktop/src/main/maker-host/cc-remote-mcp.ts@@ -149,6 +149,11 @@ export async function buildCcRemoteHttpMcpServers(// 无注入也是一代 (collab 禁用 / 白名单空):指纹常量 'disabled',// 开→关的重启后 drift 判定成立 (R23 P2);不含 instanceId, 一直禁用// 的健康 query 不被误判。+ // 禁用必须同时摘掉本 session 在 bridge 上的旧 ctx (此前注入注册):+ // 不摘的话 ?session=<id> 的授权路由在 collab 已禁用后仍可用, 直到+ // bridge 关闭 (codex-connector R26 P2)。token 轮换/失效不需要这里+ // 清 — 鉴权层已按新 token 拒旧请求。+ started.bridge.unregisterSessionCtx(args.sessionId);return { ...empty, fingerprint: CC_MCP_DISABLED_FINGERPRINT };}const remotePort = await deps.ensureForward(args.host, started.port);