Skip to content

fix(mcp): stop retaining empty session runtimes - #150901

Merged
RomneyDa merged 4 commits into
mainfrom
upd/flake-bundle-mcp-requester-leftovers
Sep 17, 2026
Merged

RomneyDa merged 4 commits into
mainfrom
upd/flake-bundle-mcp-requester-leftovers

Conversation

@steipete

@steipete steipete commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Related: #150364. Observed in #150819 / run 35212277809 and #150244 / run 35217608611.

What Problem This Solves

Fixes empty MCP runtime records accumulating after serverless agent runs, which made a later session's cleanup assertion fail when the memory-transcript and requester-lifecycle tests shared a worker.

User Impact

Serverless and hidden memory sessions no longer leave empty MCP runtime records behind. Prepared tools, active server ownership, and requester sign-in capabilities retain their existing lifetimes. No configuration, dependency, schema, migration, or timeout changes are required.

Why This Change Was Made

The manager released connection capacity without removing empty runtime entries, and skipped cleanup entirely for entries that never consumed capacity. It now joins cleanup, rechecks the current owner, removes empty entries and connection metadata only after their retained handles release, and clears session-key bindings after admission drains. Sign-in-only requester runtimes remain tracked so configuration changes can revoke their capabilities.

This retention predates #150364; that PR added the assertion which exposed it. The four leftovers belonged to the earlier memory test: three internal-session-effects-* entries and private-memory-source. The requester test's own HTTP sessions had already closed successfully.

The regression preserves the original file order in one worker without a consumer reset. Existing lifetime and TTL tests now use configured server fixtures; their assertions remain. Idle-policy tests moved into a smaller file, reducing the large runtime test by 61 lines.

Evidence

The original campaign evidence below is for 185afaf795157f79dbc3a750c5879f3c83070096; the follow-up boundary proof is recorded separately below.

Original-order proof Before After
macOS 20/20 failed with the four foreign entries 20/20 passed
Linux Testbox, Node 24.19.0 20/20 failed with the four foreign entries 20/20 passed

The order was memory-transcript first, requester-lifecycle second, using the unit-fast configuration with isolation disabled and one worker. Linux also passed 20 repetitions of the requester file with CI's two-worker settings. Both platforms passed the original-order probe with eight CPU-burner processes active.

431 unit tests across 29 files have passing results, covering CLI-runner bundle MCP, MCP runtime/acquisition/reload, memory transcripts, and session-reset cleanup/concurrency. The initial broad run exposed 14 stale empty-fixture assertions; the repaired runtime/idle suites passed all 128 tests, and the remaining CLI partitions passed all 60 tests.

node scripts/check-changed.mjs passed on the final change. Fresh Codex autoreview with --mode branch --base origin/main --max-priority P1 is scoped-clean at commit 185afaf795157f79dbc3a750c5879f3c83070096.

Linux Testbox run: command proofs completed with exit 0. A portal metadata sync timed out after the final successful command; the lease was stopped.

Reproduction command and representative leftovers

The original repeated command was:

OPENCLAW_VITEST_FS_MODULE_CACHE_PATH="$PWD/.artifacts/l588/vitest-cache" \
node scripts/run-vitest.mjs run \
  --config .artifacts/l588/original-order.config.ts --reporter=verbose \
  src/auto-reply/reply/agent-runner-memory.private-transcript.test.ts \
  src/agents/cli-runner/bundle-mcp.requester-lifecycle.test.ts

That temporary config extends unit-fast and forces the stated file order, maxWorkers: 1, and isolate: false. The tracked equivalent is exercised by:

node scripts/run-vitest.mjs src/agents/agent-bundle-mcp-retention.test.ts

Representative pre-fix keys:

internal-session-effects-01506525-5f40-41b6-a590-a8c7fdb0253f-16a74d9ce267ffc9
internal-session-effects-668d0645-fbb0-4ea3-a23b-77d61f87fcd8-e8d0ee5a87ce6fb2
internal-session-effects-ec99ec55-997e-4f8f-a069-3cde7d5f3ce9-2b04df6f6a55e51b
private-memory-source

Production LOC: +28/-9. Tests and support: +224/-97, including the idle-policy test move. Changelog remains release-owned.

Follow-up lifecycle boundary proof

Review requested three forced-order checks against the original PR head. They exercise real HTTP MCP transports and the registered native CLI preflight, without replacing manager ownership decisions with mocks.

Test Before owner fix After owner fix
retains an empty runtime until its live materialized handle releases Failed: entry removed while a lease remained live Passed
preserves a newer session binding while old empty cleanup drains Passed Passed
preserves the runtime admitted by an in-flight static native preflight Passed Passed

The retained-handle check found a real gap: transport cleanup freed capacity and removed the facade despite its active lease. The manager now retains that binding until the final handle releases, then reaps empty unleased partitions through the existing release-completion path. It does not arm whole-session retirement or remove live siblings. Configuration removal still revokes removed tools; the retained facade remains readable.

The rebinding test admits a new session with the same session key and server name while the old DELETE is held. The preflight test holds the real tools/list request open across cleanup and verifies the admitted runtime remains registered and callable after preparation. All 194 tests in the eight-file follow-up regression/sibling selection passed, including the original cross-file memory/requester regression.

At d8e2d6650eb7eee5a41baa729845e341b5e0a19e, changed-file checks passed and fresh Codex autoreview (--mode branch --base origin/main --max-priority P1) is scoped-clean.

CI fixture repairs

Run 35227538461 at d8e2d6650eb7eee5a41baa729845e341b5e0a19e failed the unused-file guard and seven shards. Each failed job log was inspected. All seven contain assertion failures caused by fixtures relying on retained empty runtimes; none is a worker timeout, unhandled rejection, class #66, or shared infrastructure failure.

Shard / job Log excerpt Attribution and repair
large-20 / 105223187495 expected undefined to be { sessionId: 'rotated-session' ... } Empty compaction successor fixture; configure an unopened server so successor preservation remains tested.
large-14 / 105223182019 mcp-connection-resolver.test.ts:268 — expected undefined to be defined The requester-only configuration leaves an empty static partition, which is what peekSession observes. Inspect the actual requester runtime key; retain the real authenticated requester calls and revocation assertions.
large-16 / 105223181965 owns MCP predecessor cleanup after rotation/unchanged/cancel-after-commit — expected undefined to be { ... } Three empty successor fixtures; configure an unopened server and preserve all ownership assertions.
large-7 / 105223181939 expected [] to include 'session:subagent:mcp-retire' Empty subagent fixture disappeared before completion; configure an unopened server and preserve cleanup assertions.
large-13 / 105223181765 retires only run-owned IDs when cleanup is false/true — expected undefined to be { ... } Empty successor/rebound fixtures; configure unopened servers and preserve the run-owned retirement assertions.
large-12 / 105223181462 expected undefined to be { sessionId: 'idle-mcp' ... } Empty idle fixture; configure an unopened server so the non-clearing abort must preserve it.
small-21 / 105223181620 expected [] to include 'stale-runtime-session' Empty rollover fixture failed before session initialization; configure an unopened server and retain both before/after assertions.

The existing manager test-support module now shares the unopened-server configuration across these suites. No additional production change was needed. The one-use agent-bundle-mcp-retention.test-support.ts is deleted; its sole consumer creates the same ordered Vitest configuration in its existing tracked temporary directory. The original memory-before-requester worker boundary, isolation settings, and assertions remain.

Local proof for this fixture repair: 454 tests across ten files passed, including all seven failed CI suites, the original shared-worker order regression, and all three lifecycle boundary checks. After the final requester-key and session-fixture edits, both affected files passed again (240 tests); the authenticated plugin-revocation case completed in 620 ms. pnpm deadcode:full passed on the final diff, and the exact CI unused-file guard passed both production and full-tree scans with zero entries. Follow-up LOC: production +0/-0; tests/support +79/-63.

At cf5467c9446dc639c391c1b4e9b5d3b8a1a0dcc5, node scripts/check-changed.mjs passed in full. Fresh Codex autoreview (--mode branch --base origin/main --max-priority P1) is scoped-clean on the committed branch. The local pre-commit P1 review was also scoped-clean. Hosted CI on this head is the final platform check; the lane stops at its first terminal state without rerunning jobs.

Hosted follow-up: remaining fixture assumptions

Run 35231526382 used CI merge 8f854c40a7588fc1bc06ed3ebaf69dd2c9c8004d (PR head cf5467c9446dc639c391c1b4e9b5d3b8a1a0dcc5 merged into base 9bea925e27aa632f37e99a7d2698e5f912f71d94). All three failed job logs were read.

Shard / job Every failing case and assertion Verdict
large-20 / 105236999379 cli-runner.before-agent-reply-cron.test.ts:985, “does not retire a newer MCP runtime after its stable session key is rebound”: expected undefined to be { …(27) } Empty fixture: both runtimes used servers: {}. The successor-by-ID assertion failed before the key assertion. The test now uses the shared unopened-server configuration and also asserts the rebound key before old-run cleanup.
large-4 / 105236992865 agent-runner-memory.private-transcript.test.ts:289, “keeps completed optional memory inference out of the next human turn” and “keeps interrupted optional memory inference out of the next human turn”: expected false to be true Empty fixture: #150899 added live-runtime assertions on main, but this fixture configured no MCP server. It now declares a synthetic HTTP MCP server.
large-13 / 105236992679 agent-bundle-mcp-retention.test.ts:65, “does not retain memory-session MCP runtimes across shared-worker files”: expected 1 to be +0; its child reports the same two memory cases and expected false to be true Same memory fixture failure propagated through the original-order wrapper. The child requester-lifecycle case passed in 104 ms.

The branch is rebased onto main commit 077604ff7dc60b504d023b18b28beeb716f70848, bringing in #150899's memory lifetime assertions. No additional manager change was needed: binding removal already checks the currently mapped session ID, and CLI settlement retires the immutable original session ID. All existing assertions remain.

Memory preparation materializes MCP catalogs before inference, so a bare unresponsive subprocess would introduce a connection timeout. Its existing synthetic HTTP fixture now serves a valid stateless MCP endpoint with an empty tool catalog. The runtime therefore owns a real server while the model request keeps the same tool inventory.

Hosted CI is the runtime proof of record for this follow-up, per maintainer direction. No local suites were run: the preceding head and merge-base attempts both stopped before assertions at the 120-second no-output watchdog under host overload. This follow-up changes tests only (+41/-2 LOC).

At a95974e7ed6d4bef767b48109b39de66c2c0a90d, pnpm check:changed passed in full. Fresh Codex autoreview (--mode branch --base origin/main --max-priority P1) is scoped-clean on the committed branch; the local P1 review is also scoped-clean. The next hosted pull-request run supplies the runtime proof. The lane stops at the native watcher's first terminal state without rerunning jobs or landing.

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 17, 2026
@steipete
steipete marked this pull request as ready for review September 17, 2026 13:00
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 12:42 PM ET / 16:42 UTC (Revision 5).

ClawSweeper review

What this changes

Remove empty MCP session runtime records after cleanup while preserving active handles and requester sign-in capabilities, and update lifecycle regression fixtures.

Merge readiness

✅ Ready for maintainer review

This remains a useful, distinct runtime cleanup fix. The earlier retention concern is addressed, and no blocking correctness defect was found. The merged memory cleanup does not replace this manager-level repair.

Priority: P2
Reviewed head: 196ca3a1040e49c93490a3b786f5c75219af1cbc

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant boundary proof, preserved lifecycle assertions, and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The matching captured body records real HTTP MCP clients exercising the production manager under delayed cleanup and preflight, with retained-handle repair and successful rebinding/tool calls afterward. The production files remain byte-identical to the preceding reviewed head; subsequent changes repair test fixtures.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The matching captured body records real HTTP MCP clients exercising the production manager under delayed cleanup and preflight, with retained-handle repair and successful rebinding/tool calls afterward. The production files remain byte-identical to the preceding reviewed head; subsequent changes repair test fixtures.
Evidence reviewed 8 items Cleanup remains with the existing owner: The introduced cleanup joins transport cleanup, rechecks runtime identity, and removes records only when no servers, active leases, or requester sign-in catalog remain. Session-key deletion checks the currently mapped session ID and outstanding acquisition chains.
Final handle release and metadata publication: Release completion reaps empty partitions without requesting whole-session retirement; requester installation publishes connection metadata only if its runtime remains registered.
Still necessary on fetched main: Fetched main still returns early for runtimes without a live capacity slot and otherwise releases capacity without deleting empty runtime records. The merged #150899 retires private memory sessions, while #150874 repairs fixture teardown; neither implements this general empty-runtime cleanup.
Findings None None.
Security None None.

How this fits together

OpenClaw’s MCP runtime manager connects agent sessions to external tool servers and owns their cached runtimes and cleanup. Agent acquisition, configuration reload, and handle release determine which connections and session bindings remain available.

flowchart TD
  A[Agent session and server configuration] --> B[MCP runtime manager]
  B --> C[Tool servers and retained handles]
  C --> D[Handle release or configuration reload]
  D --> E[Join cleanup and check current ownership]
  E --> F{Servers, handles, or sign-in capabilities remain?}
  F -->|Yes| G[Keep runtime registered]
  F -->|No| H[Remove empty runtime and unused binding]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +26, Tests +444. Total +470 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 3 39 13 +26
Tests 15 574 130 +444
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 613 143 +470

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +26 lines; tests/support net +444 lines Production growth stays within the existing lifecycle owner; most growth protects cleanup ordering and adapts fixtures to meaningful server ownership.

Technical review

Best possible solution:

Keep empty-record reclamation in the MCP lifecycle owner while preserving useful server connections, active handles, and revocable requester sign-in capabilities.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes the empty-record retention path, and the acquisition regression checks it before teardown. Historical before-and-after runs are supplied; this read-only review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes. The repair extends the existing cleanup owner and protects live handles, replacement identity, and requester capabilities without adding a parallel cleanup mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a1cc9b38c1c8.

Labels

Label justifications:

  • P2: This repairs bounded MCP runtime retention without evidence of an urgent user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The matching captured body records real HTTP MCP clients exercising the production manager under delayed cleanup and preflight, with retained-handle repair and successful rebinding/tool calls afterward. The production files remain byte-identical to the preceding reviewed head; subsequent changes repair test fixtures.
  • proof: sufficient: Contributor real behavior proof is sufficient. The matching captured body records real HTTP MCP clients exercising the production manager under delayed cleanup and preflight, with retained-handle repair and successful rebinding/tool calls afterward. The production files remain byte-identical to the preceding reviewed head; subsequent changes repair test fixtures.

Evidence

What I checked:

  • Cleanup remains with the existing owner: The introduced cleanup joins transport cleanup, rechecks runtime identity, and removes records only when no servers, active leases, or requester sign-in catalog remain. Session-key deletion checks the currently mapped session ID and outstanding acquisition chains. (src/agents/agent-bundle-mcp-manager-lifecycle.ts:147, 196ca3a1040e)
  • Final handle release and metadata publication: Release completion reaps empty partitions without requesting whole-session retirement; requester installation publishes connection metadata only if its runtime remains registered. (src/agents/agent-bundle-mcp-manager.ts:338, 196ca3a1040e)
  • Still necessary on fetched main: Fetched main still returns early for runtimes without a live capacity slot and otherwise releases capacity without deleting empty runtime records. The merged fix(memory): release MCP runtimes after memory flushes #150899 retires private memory sessions, while fix(tests): retire private-memory fixture MCP sessions #150874 repairs fixture teardown; neither implements this general empty-runtime cleanup. (src/agents/agent-bundle-mcp-manager-lifecycle.ts:147, a1cc9b38c1c8)
  • Complete captured proof body inspected: The full GitHub body contains 12,520 UTF-16 units and matches captured SHA-256 31af5e1eec621ed59564929b7d0bcd26a611f0bf4c0779c67ff5a64a5e32a0b2. It records original-order macOS/Linux before-and-after results and real HTTP lifecycle checks covering retained handles, delayed DELETE with rebinding, and delayed tools/list during CLI preflight. The retained-handle case failed before its repair and passed afterward; later fixture-only changes and their validation are separately identified. (196ca3a1040e)
  • Review continuity: GitHub content identities for all three production files at the previous reviewed head a95974e7ed6d4bef767b48109b39de66c2c0a90d match the current checkout. The current memory test asserts runtime presence during inference and retirement before fixture teardown; acquisition coverage also asserts empty runtime keys and forgotten session bindings before teardown. The earlier concrete finding is addressed. (src/auto-reply/reply/agent-runner-memory.private-transcript.test.ts:316, 196ca3a1040e)
  • Relevant merged ownership history: GitHub identifies steipete as the author of the merged selective-cleanup change in fix(mcp): stop unused servers from accumulating across sessions #150364. Its patch adds the current manager call to releaseEmptyRuntimeSlot. Main history also shows qingminlong’s requester ownership and catalog maintenance. Some local historical blobs were unavailable, so GitHub content reads supplied the previous-head comparison; no unsupported introduction claim is made. (src/agents/agent-bundle-mcp-manager.ts:64, a3a2d39a8e81)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • qingminlong: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-17T13:09:02.788Z sha 185afaf :: needs changes before merge. :: [P2] Assert empty-runtime retention before fixture teardown hides it
  • reviewed 2026-09-17T13:39:10.369Z sha d8e2d66 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-17T14:15:06.842Z sha cf5467c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-17T15:06:53.540Z sha a95974e7ed6d4bef767b48109b39de66c2c0a90d :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 17, 2026
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 17, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 17, 2026
@steipete
steipete force-pushed the upd/flake-bundle-mcp-requester-leftovers branch from cf5467c to a95974e Compare September 17, 2026 14:59
steipete added a commit that referenced this pull request Sep 17, 2026
Fix an intermittent Gateway restart benchmark test failure when a busy runner delays the healthy fixture response beyond the real probe deadline.

Supply one healthy observation through the existing requestProbeStatus export and derive readiness from that observation. Preserve the real waitForRestartProbe flow, existing timing and downtime assertions, and separate HTTP deadline and recovery tests. Restore the spy in finally and assert no error or further polling.

No user-visible or runtime change. Production/tooling: +0/-0; tests: +15/-18. Related: #150901.

Validation: exact-head CI run 35244901923 passed; recorded proof includes 33/33 macOS tests, 1,284 Linux shard tests, and 660 tests across 20 Linux pressure runs. Independent review was scoped-clean and ClawSweeper found no actionable defects.
Remove serverless MCP facades after joined cleanup while preserving requester sign-in capabilities and current replacement ownership. Clear session-key bindings once admission drains, and avoid republishing metadata for a removed runtime.

Fix pre-existing retention exposed by #150364. Preserve lifecycle and idle-policy assertions with configured server fixtures and track the original memory-to-requester test order without a consumer reset.

Validation: 20 ordered before/after runs on macOS and Linux, Linux two-worker repetition, CPU-pressure proof on both platforms, 431 focused tests, changed checks, and clean P1 review.
Keep a drained facade registered while its retained lease is live. Reap empty unleased partitions through the existing handle-release completion path without arming whole-session retirement or retiring useful siblings.

Add forced-order boundary coverage for retained handles, concurrent session-key rebinding, and static native preflight. The retained-handle case failed at 185afaf; rebinding and preflight passed. All three now pass, along with 194 regression/sibling tests and changed checks.
@steipete
steipete force-pushed the upd/flake-bundle-mcp-requester-leftovers branch from a95974e to 196ca3a Compare September 17, 2026 16:35
@RomneyDa
RomneyDa merged commit 15e2d99 into main Sep 17, 2026
205 checks passed
@RomneyDa
RomneyDa deleted the upd/flake-bundle-mcp-requester-leftovers branch September 17, 2026 17:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…#150985)

Fix an intermittent Gateway restart benchmark test failure when a busy runner delays the healthy fixture response beyond the real probe deadline.

Supply one healthy observation through the existing requestProbeStatus export and derive readiness from that observation. Preserve the real waitForRestartProbe flow, existing timing and downtime assertions, and separate HTTP deadline and recovery tests. Restore the spy in finally and assert no error or further polling.

No user-visible or runtime change. Production/tooling: +0/-0; tests: +15/-18. Related: openclaw#150901.

Validation: exact-head CI run 35244901923 passed; recorded proof includes 33/33 macOS tests, 1,284 Linux shard tests, and 660 tests across 20 Linux pressure runs. Independent review was scoped-clean and ClawSweeper found no actionable defects.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
* fix(mcp): stop retaining empty session runtimes

Remove serverless MCP facades after joined cleanup while preserving requester sign-in capabilities and current replacement ownership. Clear session-key bindings once admission drains, and avoid republishing metadata for a removed runtime.

Fix pre-existing retention exposed by openclaw#150364. Preserve lifecycle and idle-policy assertions with configured server fixtures and track the original memory-to-requester test order without a consumer reset.

Validation: 20 ordered before/after runs on macOS and Linux, Linux two-worker repetition, CPU-pressure proof on both platforms, 431 focused tests, changed checks, and clean P1 review.

* fix(mcp): retain empty runtimes until handles release

Keep a drained facade registered while its retained lease is live. Reap empty unleased partitions through the existing handle-release completion path without arming whole-session retirement or retiring useful siblings.

Add forced-order boundary coverage for retained handles, concurrent session-key rebinding, and static native preflight. The retained-handle case failed at 185afaf; rebinding and preflight passed. All three now pass, along with 194 regression/sibling tests and changed checks.

* fix(mcp): align retirement fixtures with runtime ownership

* fix(mcp): configure remaining runtime lifetime fixtures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants