Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): node_repl 路由过滤改按 spawn provision 判定,保住就绪探测失败后的禁用
david8c99534b589d
diff --git a/apps/desktop/src/main/maker-host/__tests__/capability-routing.test.ts b/apps/desktop/src/main/maker-host/__tests__/capability-routing.test.tsindex fae878ed40..e7c39264c5 100644--- a/apps/desktop/src/main/maker-host/__tests__/capability-routing.test.ts+++ b/apps/desktop/src/main/maker-host/__tests__/capability-routing.test.ts@@ -46,6 +46,7 @@ describe('buildDesktopCapabilityRoutingPolicy', () => {const routes = buildDesktopCapabilityRoutingPolicy({cindyBrowserEnabled: true,codexBrowserUseAvailable: true,+ codexBrowserUseProvisioned: true,}).overrides;expect(routes).toContainEqual(expect.objectContaining({@@ -55,10 +56,29 @@ describe('buildDesktopCapabilityRoutingPolicy', () => {}));});+ it('keeps the node_repl disable when the provisioned companion fails its readiness probe', () => {+ // Spawn supplied a full node_repl transport (provisioned), then the+ // session-time Chrome readiness probe failed. The per-thread disable+ // merges onto the real transport and is required — dropping it would+ // leave the privileged node_repl surface enabled.+ const policy = buildDesktopCapabilityRoutingPolicy({+ cindyBrowserEnabled: false,+ codexBrowserUseAvailable: false,+ codexBrowserUseProvisioned: true,+ });++ const nodeReplRoute = policy.overrides.find(+ (route) => route.source.surface === 'mcp' && route.source.id === 'node_repl',+ );+ expect(nodeReplRoute).toMatchObject({ invocation: 'disabled' });+ expect(nodeReplRoute?.replacement).toBeUndefined();+ });+it('fails closed without claiming a replacement when neither browser runtime is available', () => {const policy = buildDesktopCapabilityRoutingPolicy({cindyBrowserEnabled: false,codexBrowserUseAvailable: false,+ codexBrowserUseProvisioned: false,});const routes = policy.overrides.filter((route) =>@@ -83,6 +103,7 @@ describe('buildDesktopCapabilityRoutingPolicy', () => {const policy = buildDesktopCapabilityRoutingPolicy({cindyBrowserEnabled: true,codexBrowserUseAvailable: false,+ codexBrowserUseProvisioned: false,});expect(policy.overrides.some(diff --git a/apps/desktop/src/main/maker-host/capability-routing.ts b/apps/desktop/src/main/maker-host/capability-routing.tsindex ff8bec3f18..19f29ff723 100644--- a/apps/desktop/src/main/maker-host/capability-routing.ts+++ b/apps/desktop/src/main/maker-host/capability-routing.ts@@ -194,15 +194,20 @@ const CODEX_CHROME_USE_UNAVAILABLE_OVERRIDES = CODEX_CHROME_USE_OVERRIDES.map(* entry only when the verified Browser companion was provisioned; without it,* the per-thread `mcp_servers.node_repl.enabled=false` override synthesizes a* transport-less entry and every thread/start fails with "invalid transport"- * (-32600). Emit the node_repl MCP route only when the entry exists — when it- * does not, the capability is already absent and fail-closed holds without- * the directive.+ * (-32600). Emit the node_repl MCP route only when the spawn transport exists+ * — when it does not, the capability is already absent and fail-closed holds+ * without the directive.+ *+ * The gate is spawn-time provisioning, NOT session-time availability: a+ * provisioned companion whose Chrome readiness probe failed still has the+ * full node_repl transport in its spawn config, so the disable both merges+ * cleanly and is required to keep the privileged surface off.*/function withoutUnprovisionedNodeReplRoute(overrides: readonly CapabilityRouteOverride[],- codexBrowserUseAvailable: boolean | undefined,+ codexBrowserUseProvisioned: boolean | undefined,): CapabilityRouteOverride[] {- if (codexBrowserUseAvailable === true) return [...overrides];+ if (codexBrowserUseProvisioned === true) return [...overrides];return overrides.filter((override) =>!(override.source.surface === 'mcp' && override.source.id === 'node_repl'),@@ -215,7 +220,14 @@ export function buildDesktopCapabilityRoutingPolicy(opts: {cindyComputerAvailable?: boolean;/** Workspace-scoped Cindy Browser ownership snapshot. */cindyBrowserEnabled?: boolean;+ /** Session-time snapshot: companion provisioned AND Chrome currently ready. */codexBrowserUseAvailable?: boolean;+ /**+ * Spawn-time snapshot: the verified companion supplied a full node_repl+ * transport to this app-server. Gates the mcp node_repl route (a per-thread+ * disable is only valid — and only needed — when the entry exists).+ */+ codexBrowserUseProvisioned?: boolean;/** Remote Codex cannot invoke the local Cindy Browser plugin bridge. */remoteHostId?: string | null;}): CapabilityRoutingPolicy {@@ -232,12 +244,12 @@ export function buildDesktopCapabilityRoutingPolicy(opts: {: cindyBrowserEnabled? withoutUnprovisionedNodeReplRoute(CODEX_CHROME_USE_OVERRIDES,- opts.codexBrowserUseAvailable,+ opts.codexBrowserUseProvisioned,): opts.codexBrowserUseAvailable === false? withoutUnprovisionedNodeReplRoute(CODEX_CHROME_USE_UNAVAILABLE_OVERRIDES,- opts.codexBrowserUseAvailable,+ opts.codexBrowserUseProvisioned,): [];return {diff --git a/apps/desktop/src/main/maker-host/index.ts b/apps/desktop/src/main/maker-host/index.tsindex d034ad7d4a..807502b693 100644--- a/apps/desktop/src/main/maker-host/index.ts+++ b/apps/desktop/src/main/maker-host/index.ts@@ -1021,6 +1021,7 @@ export function getMaker(): Maker {getActiveCodexBridgeServerNames()?.includes('cindy_computer') === true,cindyBrowserEnabled,codexBrowserUseAvailable: connectedCodexBrowserUse,+ codexBrowserUseProvisioned,remoteHostId,});},