[codex] feat(mcp): share bundled runtime scope and fix preflight compaction abort#95563
[codex] feat(mcp): share bundled runtime scope and fix preflight compaction abort#95563yu-xin-c wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 21, 2026, 10:05 AM ET / 14:05 UTC. Summary PR surface: Source +156, Tests +261, Docs +14, Generated 0. Total +431 across 12 files. Reproducibility: yes. at source level: current main passes the reply-operation abort into required budget compaction and keys bundled MCP runtimes by session id. I did not run a live slow-provider compaction or MCP process-reuse reproduction in this read-only review. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Split or explicitly approve the two surfaces: land the preflight abort repair under a defined cancellation contract, and merge shared MCP runtime only after maintainers accept the opt-in single-tenant isolation boundary with real runtime proof. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main passes the reply-operation abort into required budget compaction and keys bundled MCP runtimes by session id. I did not run a live slow-provider compaction or MCP process-reuse reproduction in this read-only review. Is this the best way to solve the issue? Unclear as a combined PR: removing the preflight abort is a plausible call-site repair, but shared MCP runtime is a new opt-in isolation boundary that needs maintainer approval and real behavior proof before it can be called the best fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ac5d219be316. Label changesLabel justifications:
Evidence reviewedPR surface: Source +156, Tests +261, Docs +14, Generated 0. Total +431 across 12 files. View PR surface stats
Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
…law#95553) Adds a user-facing config gate to disable preflight (budget-triggered) compaction. When compaction.preflight.enabled === false, the pre-turn threshold check in runPreflightCompactionIfNeeded short-circuits to the existing session entry, so subsequent turns fall through to overflow recovery (which already honors compaction.timeoutSeconds with a 15min budget). The check is '=== false' against the literal value, so an unset key preserves the existing default-on behavior — the fix is strictly additive and does not change shipped behavior for any current user. This complements the four open PRs (openclaw#95561, openclaw#95563, openclaw#95580, openclaw#95590) that are all working on the abortSignal source for the preflight path. None of those PRs addresses the user-facing config dimension that the issue explicitly requests. Changes: - src/config/types.agent-defaults.ts: new AgentCompactionPreflightConfig type with optional enabled boolean - src/config/zod-schema.agent-defaults.ts: zod schema with strict mode - src/config/schema.help.ts + schema.labels.ts: help text + label - src/auto-reply/reply/agent-runner-memory.ts: 6-line early return in runPreflightCompactionIfNeeded, placed after isHeartbeat/isCli and before codex runtime so the gate is the only OpenClaw-specific path affected - src/auto-reply/reply/agent-runner-memory.test.ts: 1 new test (skips preflight compaction when enabled === false) using the same test fixture pattern as adjacent tests - scripts/repro/issue-95553-preflight-disabled-gate.mts: standalone real-environment proof that exercises the production gate Refs openclaw#95553
What Problem This Solves
Fixes #95553 by keeping required preflight/budget compaction from inheriting the reply operation abort signal. The compaction path now relies on the embedded compaction safety timeout, so
agents.defaults.compaction.timeoutSecondsis no longer silently capped by a shorter reply-operation abort.Addresses #95506 by adding an opt-in
mcp.runtimeScope: "shared"mode for bundled MCP runtimes. Sessions with the same workspace and MCP config fingerprint can share one MCP runtime, collapsing duplicate stdio child processes, catalog caches, and repeatedtools/listwork. The default remains"session".This overlaps the product direction in #79882. This draft rebases that shape onto current
main, keeps the mode opt-in, and includes the primary configuration-reference warning that shared mode trades per-session MCP isolation for single-tenant runtime reuse.Why This Change Was Made
Preflight compaction already has a configurable safety timeout, but the preflight caller passed
replyOperation.abortSignal, letting unrelated reply-operation cancellation win before the compaction timeout could be honored.Bundled MCP runtimes were keyed only by session id. In multi-session single-tenant deployments, identical workspace/config sessions therefore fanned out into duplicate MCP runtime objects, catalogs, stdio transports, and
tools/listrequests.User Impact
mcp.runtimeScopeis set.mcp.runtimeScope: "shared"in trusted single-tenant deployments to reuse warm bundled MCP clients across matching sessions.Evidence
node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner-memory.test.ts src/agents/embedded-agent-runner.compaction-safety-timeout.test.ts src/agents/agent-bundle-mcp-runtime.test.ts src/config/schema.test.ts src/config/schema.hints.test.ts src/config/schema.help.quality.test.ts src/config/doc-baseline.test.ts src/config/doc-baseline.integration.test.tscorepack pnpm tsgo:corecorepack pnpm tsgo:test:srccorepack pnpm config:docs:checkgit diff --check