Skip to content

fix(mcp): stop unused servers from accumulating across sessions - #150364

Merged
steipete merged 3 commits into
mainfrom
upd/mcp-session-child-reaping
Sep 17, 2026
Merged

steipete merged 3 commits into
mainfrom
upd/mcp-session-child-reaping

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #142965
Closes #147041

What Problem This Solves

Agents can start MCP servers that their tool policy wholly denies, and native discovery can leave excluded servers alive outside the final prepared bundle. Mixed static/requester setups also need their advertised requester tools to remain callable after static native preflight.

User Impact

Wholly denied servers never start. Prepared native MCP servers, including their OAuth context, remain connected for the session and retire when the session closes. Unleased discovery-only servers outside the final bundle can close earlier without interrupting useful peers. Static native preflight preserves the separate requester connections and advertised catalog.

Thanks to @michaeljgood71 and @terrencehinds99 for the completed-session and denied-agent traces.

Why This Change Was Made

Both native preparation paths compute retained membership after final policy and OAuth projection. Releasing the acquisition passes that membership to its exact runtime owner, which retires only excluded, unleased servers and releases an empty owner's capacity slot. Current-owner checks protect replacements; composite cleanup joins every acquired partition before reporting failure.

The acquisition owner no longer interprets an omitted requester partition as removal: native preflight deliberately supplies a static-only projection. Requester acquisition owns reconciliation of its advertised catalog. Existing config publication and credential revalidation retain actual removal/revocation authority, and the existing per-server retirement diagnostic records retirement at that owner.

The final bundle's servers remain under the existing session lifecycle owner. CLI/embedded run-end, reset, explicit Stop, and Gateway shutdown still perform session retirement independently of an unset idle TTL. Preparation failure releases its lease without asserting that the prepared bundle is empty. Whole-server denials gate connection setup using prepared policy facts and stable full-declaration names; tools.effective consumes the same facts.

No configuration option, environment surface, TTL default, dependency, schema, or process reaper changed. The isolated-heartbeat leak is already fixed by #143433 (109972b2aa0); #150306 covers stalled-relay escalation, and #150339 covers the shared incoming MCP HTTP listener. This candidate runtime repair needs no updater-driver marker or data migration.

Evidence

Coverage for #147041: configured stdio servers (including npx launchers) share the session lifecycle owner disposeMcpClient → closeOwnedStdioProcess; all 9 selected existing lifecycle tests passed once on 46791e8eff8e, including bundle-mcp.discovery-lifecycle.test.ts and mcp-stdio-transport.process.test.ts, confirming synthetic process-tree extinction after cleanup while preserving active and requester leases.

The mixed-server regression runs the real requester harness materialization followed by the real native app-server preflight with the same session/sender. It uses a local HTTP MCP fixture and isolated state.

Boundary Before (5830d95542c) After
Requester tool execution after static native preflight Rejected: bundle-mcp runtime disposed for session mixed-native-discovery Returns the original requester session ID
Runtime and advertised catalog after preflight Requester runtime disposed; catalog cleared Both HTTP sessions live, zero DELETE requests, requester catalog retained
Session end while requester lease is active — No early disposal; releasing the final lease closes both HTTP sessions and leaves zero runtime keys

Applied the sole Rank-up move in ClawSweeper's review of 5830d95542c: removed projection-triggered requester disposal and added a mixed static/requester regression that executes the requester tool after native preparation. No rank-up moves skipped.

The previous CI failures (localTools empty and OAuth read_docs missing immediately after preparation) remain covered. Both unchanged OAuth contract tests passed 10/10 each. Both real-stdio native lifecycle cases (app-server and CLI) also passed 10/10 each:

node scripts/run-vitest.mjs src/agents/cli-runner/bundle-mcp.user-config.test.ts \
  src/agents/cli-runner/bundle-mcp.discovery-lifecycle.test.ts \
  -t 'omits unavailable OAuth servers without blocking the CLI agent|keeps native OAuth refresh available while projecting the child bearer|keeps prepared servers usable until session end' \
  --repeats 9

Across those lifecycle repeats, 60 allowed sessions retained two callable servers after preparation, retired one excluded discovery server, and returned to zero live server/anchor/relay PIDs after every session. 20 wholly denied sessions started zero servers. Owner tests also cover active leases, stale acquisitions, unchanged transport reuse, true revocation, and 257 empty releases without capacity exhaustion.

  • 313 focused tests passed across 15 files, covering the manager, session runtime, acquisition/reload, harness, adapters, and settlement. The mixed-server regression also passed again after its final fixture type/lint corrections.
  • node scripts/check-changed.mjs passed in full: production/test typechecks, lint, line-cap checks, and every selected guard. No extension-lint substitution was needed.
  • Fresh Codex review (--mode branch --base origin/main --max-priority P1) is scoped-clean at 4ebedf45663cf0b894093739e7e2a1eee3e2ae99, with no actionable P0/P1 findings.
  • Final process inventory: 0 remaining service-child-relay processes owned by this worktree. Synthetic fixture state and generated test workers were removed by their lifecycle cleanup.

The earlier isolated Gateway proof remains relevant to unchanged gating/session-end paths: denied starts fell from two to zero with the same 36 model-visible tools; three ordinary chat/reset cycles and three isolated heartbeats returned to zero relays/servers after closure. It used the built-in runtime and a local mock provider. No operator Gateway or live model service was used.

This follow-up: production +16/-19 (net -3); tests +173/-0. PR total: production +313/-208 (net +105), tests +467/-6 (net +461), docs +2. The remaining production growth belongs to prepared policy gating and selective cleanup through existing owners; this correction removes the extra disposal path. No suppression or baseline was added. Lazy imports and package boundaries are unchanged, so no full build was needed for this follow-up.

Sibling follow-up remains sandbox-browser provisioning at src/agents/sandbox/context.ts:333: its explicit retained-container lifetime requires separate treatment. CUA/LSP execution cleanup, browser profile ownership, and host-exec command scopes were preserved.

@clawsweeper

clawsweeper Bot commented Sep 16, 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 docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 22:54
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 3:16 AM ET / 07:16 UTC (Revision 7).

ClawSweeper review

What this changes

Prevents wholly denied MCP servers from connecting and retires unused discovery connections while preserving prepared tools and requester connections until session closure.

Merge readiness

✅ Ready for maintainer review

This remains a useful repair beyond the related merged fixes. The prior requester-disposal concern is resolved, the supplied production-path proof supports the intended lifecycle, and no blocking introduced defect was found.

Priority: P2
Reviewed head: 46791e8eff8ea3789fd5754da165f65f1eef0206

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with strong production-path evidence and no remaining actionable correctness finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured evidence exercises OpenClaw’s native preparation and session owner with real stdio children and HTTP MCP clients: excluded connections close, retained tools remain callable, requester calls survive static preflight, and session closure drains remaining connections.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured evidence exercises OpenClaw’s native preparation and session owner with real stdio children and HTTP MCP clients: excluded connections close, retained tools remain callable, requester calls survive static preflight, and session closure drains remaining connections.
Evidence reviewed 9 items Pinned introduction and current-main comparison: Reviewed the merge-base-to-head changes using the supplied verified identities. Current main retains the earlier manager behavior without selective acquisition cleanup; the related merged heartbeat, relay, and listener repairs do not implement this change.
Selective cleanup stays with the existing owner: Cleanup checks the exact installed runtime, removes only excluded servers with no active lease, preserves surviving transports for replacement, and joins physical cleanup before releasing empty capacity.
Prior finding addressed: Requester acquisition now owns advertised-catalog reconciliation. The new mixed HTTP regression invokes the requester tool after static native preparation, checks that neither HTTP session was deleted early, and verifies final lease release closes both sessions.
Findings None None.
Security None None.

How this fits together

OpenClaw’s MCP runtime connects configured external tool servers to agent sessions. Tool policy controls discovery, and the session lifecycle owns connection reuse and cleanup.

flowchart TD
  A[Server configuration] --> C[Policy-aware discovery]
  B[Conversation tool policy] --> C
  C --> D[Final prepared tool bundle]
  D --> E[Retain selected connections]
  D --> F[Retire unused unleased connections]
  E --> G[Session closes]
  G --> H[Release remaining connections]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +105, Tests +461, Docs +2. Total +568 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 17 313 208 +105
Tests 7 467 6 +461
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 25 782 214 +568

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +105 lines; tests net +461 lines Production growth carries prepared policy and selective cleanup through existing owners, with regression coverage for real connections and lifecycle boundaries.

Technical review

Best possible solution:

Keep connection selection and selective retirement within the existing session owner, preserving callable peers, credential revalidation, and final session cleanup.

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

Yes, source inspection identifies the denied-server discovery and unused-connection paths, and the supplied before/after evidence exercises them through production preparation entrypoints. This read-only review did not independently execute them.

Is this the best way to solve the issue?

Yes. The patch extends the existing policy and lifecycle owners, preserves session reuse, and fixes the earlier requester-preflight regression without adding another cleanup mechanism.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded MCP resource-lifecycle repair with concrete process-accumulation evidence.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured evidence exercises OpenClaw’s native preparation and session owner with real stdio children and HTTP MCP clients: excluded connections close, retained tools remain callable, requester calls survive static preflight, and session closure drains remaining connections.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured evidence exercises OpenClaw’s native preparation and session owner with real stdio children and HTTP MCP clients: excluded connections close, retained tools remain callable, requester calls survive static preflight, and session closure drains remaining connections.

Evidence

What I checked:

  • Pinned introduction and current-main comparison: Reviewed the merge-base-to-head changes using the supplied verified identities. Current main retains the earlier manager behavior without selective acquisition cleanup; the related merged heartbeat, relay, and listener repairs do not implement this change. (src/agents/agent-bundle-mcp-manager.ts:48, 46791e8eff8e)
  • Selective cleanup stays with the existing owner: Cleanup checks the exact installed runtime, removes only excluded servers with no active lease, preserves surviving transports for replacement, and joins physical cleanup before releasing empty capacity. (src/agents/agent-bundle-mcp-runtime.ts:361, 46791e8eff8e)
  • Prior finding addressed: Requester acquisition now owns advertised-catalog reconciliation. The new mixed HTTP regression invokes the requester tool after static native preparation, checks that neither HTTP session was deleted early, and verifies final lease release closes both sessions. (src/agents/cli-runner/bundle-mcp.requester-lifecycle.test.ts:24, 46791e8eff8e)
  • Captured real behavior proof: The supplied complete PR body reports 60 allowed sessions retaining two callable servers and retiring one excluded server, 20 wholly denied sessions starting no servers, and zero remaining server/anchor/relay PIDs after session closure. Its mixed HTTP before/after observations match the inspected production entrypoints and regression. These are contributor-recorded results, not executions performed during this review. (src/agents/cli-runner/bundle-mcp.discovery-lifecycle.test.ts:20, 46791e8eff8e)
  • Policy and compatibility boundary: Whole-server filtering uses stable full-declaration names and the existing explicit deny policy. Individual tool denials remain catalog-based; no persistent schema, user setting, TTL default, dependency, or public plugin API is changed. (src/agents/agent-bundle-mcp-runtime-config.ts:118, 46791e8eff8e)
  • Codex dependency signal: The changed native adapter generates Codex mcp_servers configuration after policy and OAuth projection, establishing a direct dependency on Codex’s MCP configuration contract. (src/agents/cli-runner/bundle-mcp-codex.ts:305, 46791e8eff8e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Raw commit d4f6966 adds src/agents/native-mcp-policy.ts:77 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d4f6966dbf3b; files: src/agents/native-mcp-policy.ts)

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 (6 earlier review cycles)
  • reviewed 2026-09-16T23:03:25.157Z sha ac47961 :: blocked before merge. :: [P1] Preserve requester runtimes during static native discovery
  • reviewed 2026-09-16T23:50:05.030Z sha 5830d95542ce7f30f58062000c75ec150b5f8732 :: blocked before merge. :: [P1] Preserve requester runtimes during static native discovery
  • reviewed 2026-09-17T00:28:49.076Z sha 4ebedf45663cf0b894093739e7e2a1eee3e2ae99 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-17T02:54:07.439Z sha 8a18f594e1f3f23b3a82ef4958a6d23ca3b52179 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-17T03:32:24.694Z sha d40a04d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-17T05:25:34.641Z sha 0500f0c :: 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 17, 2026
@steipete
steipete force-pushed the upd/mcp-session-child-reaping branch from 4ebedf4 to 8a18f59 Compare September 17, 2026 02:44
@steipete
steipete force-pushed the upd/mcp-session-child-reaping branch 2 times, most recently from d40a04d to 0500f0c Compare September 17, 2026 05:16
Retire native policy discovery runtimes after their leases release, and carry prepared server denials through connection setup and status without renaming surviving servers.

Related: #142965. Thanks to @michaeljgood71 and @terrencehinds99 for the completed-session and denied-agent traces.
Keep final bundle members and their OAuth context live. Retire only unleased discovery exclusions after final projection, using exact runtime ownership and releasing empty capacity slots. Existing session-close paths retire the remaining servers.

Preserve the unchanged native OAuth contracts and prove preparation, selective cleanup, and session closure with real child processes. Related: #142965.
@steipete
steipete force-pushed the upd/mcp-session-child-reaping branch from 0500f0c to 46791e8 Compare September 17, 2026 07:08
@steipete
steipete merged commit a3a2d39 into main Sep 17, 2026
212 checks passed
@steipete
steipete deleted the upd/mcp-session-child-reaping branch September 17, 2026 07:45
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 17, 2026
Stabilize the MCP catalog recovery regression under busy CI workers. The fixture
previously raced the final healthy HTTP call against a 50 ms wall-clock deadline
and observed server response submission before client catalog publication.

Synchronize six intentional timeouts with observed HTTP request arrival, retain
the real 500 ms overlap window and single-flight assertion, and await the
published catalog before successful tool execution. Extract the HTTP fixture so
the oversized test file shrinks without a baseline change or suppression.

Production behavior, timeout values, configuration, dependencies, and schemas are
unchanged. This was a pre-existing fixture timing race exposed under load, not a
regression from #150364. Production LOC: 0; tests and support: +186/-179.

Validation: controlled 100 ms response stalls failed before and passed after on
Linux and macOS; 99 session-reset tests and changed checks passed. The PR records
14 Linux and seven macOS original-shard passes; macOS attempt eight hit the
separate untouched reload-marker failure, while this target passed. The separate
marker test passed its single isolated check. Exact-head CI run 35221633216 is
green with zero pending checks. The accepted Codex review is scoped-clean and
ClawSweeper reported no actionable findings or before-merge items.

Related: #150364
CI: https://github.com/openclaw/openclaw/actions/runs/35221633216
steipete added a commit that referenced this pull request Sep 17, 2026
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.
RomneyDa pushed a commit that referenced this pull request Sep 17, 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 #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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…claw#150364)

Prevent wholly denied MCP servers from starting and retire excluded, unleased discovery connections through the existing session lifecycle owner. Keep final prepared tools and their OAuth context callable until session cleanup, and preserve requester connections and their advertised catalog during static native preflight.

Requester acquisition owns catalog reconciliation; omitting that partition from native preparation does not revoke it. Exact runtime ownership and active leases protect useful peers and replacements, while final session cleanup closes the remaining connections and owned stdio process trees. No configuration, TTL default, dependency, schema, or data migration changes.

Related: openclaw#142965
Closes openclaw#147041

Thanks to @michaeljgood71 and @terrencehinds99 for the completed-session and denied-agent traces.

Validation: 313 focused tests across 15 files and check-changed passed; repeated native/OAuth lifecycle proof preserved callable tools and returned every session to zero live children. The mixed HTTP regression verifies requester calls after native preflight. Nine existing lifecycle tests additionally cover openclaw#147041's stdio process-tree cleanup. Exact-head CI run 35193052654 is green, and native hosted CI/Testbox preparation passed at 46791e8.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
Stabilize the MCP catalog recovery regression under busy CI workers. The fixture
previously raced the final healthy HTTP call against a 50 ms wall-clock deadline
and observed server response submission before client catalog publication.

Synchronize six intentional timeouts with observed HTTP request arrival, retain
the real 500 ms overlap window and single-flight assertion, and await the
published catalog before successful tool execution. Extract the HTTP fixture so
the oversized test file shrinks without a baseline change or suppression.

Production behavior, timeout values, configuration, dependencies, and schemas are
unchanged. This was a pre-existing fixture timing race exposed under load, not a
regression from openclaw#150364. Production LOC: 0; tests and support: +186/-179.

Validation: controlled 100 ms response stalls failed before and passed after on
Linux and macOS; 99 session-reset tests and changed checks passed. The PR records
14 Linux and seven macOS original-shard passes; macOS attempt eight hit the
separate untouched reload-marker failure, while this target passed. The separate
marker test passed its single isolated check. Exact-head CI run 35221633216 is
green with zero pending checks. The accepted Codex review is scoped-clean and
ClawSweeper reported no actionable findings or before-merge items.

Related: openclaw#150364
CI: https://github.com/openclaw/openclaw/actions/runs/35221633216
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 docs Improvements or additions to documentation 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.

[Bug]: bundle-mcp leaves stdio MCP server processes running — orphaned trees accumulate (~185 MB each)

1 participant