Skip to content

fix(plugins): release retired callers after source recovery - #200571

Merged
RomneyDa merged 1 commit into
mainfrom
fix/plugin-recovery-host-context
Nov 17, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/plugin-recovery-host-context

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

What Problem This Solves

Recovering a plugin's captured source can leave its retired instance and registry alive after disposal. This was hit by the Bun recovery-source retention test during beta qualification and reproduced on main.

User Impact

Plugin recovery can release the previous instance while its successor continues using the captured source. No configuration, storage format, permission, or revocation policy changes.

Why This Change Was Made

The independent recovery host outlives the plugin call that creates it. Its transport inherited that call's invocation context, retaining the old instance through a live socket and timer. Construct the independent host outside the plugin invocation using the existing context exit operation. Capture the retained worker source in the original caller context first; preserve the other execution scopes and existing source custody.

Self-simplification: one production file, +4/-3 lines; no new helper, state, fallback, or cleanup policy. The existing end-to-end retention regression already exercises the failure, so its assertions and GC budget are unchanged.

Evidence

  • Original recovery-source retention test fails on main base 5fb231527f4f14d83bc27067879370debe4d2b7a: retired instance remains alive.
  • Synthetic failure-only heap inspection identifies RuntimeFrame.invocation retaining the retired instance through the independent transport. Temporary probes removed.
  • Final fix: 30/30 tests pass on pinned Bun, covering the complete runtime-retention suite, native-admission recovery, and native source-reference recovery.
  • Canonical targeted lint, format, core typecheck with a 12 GiB heap, and diff check pass.
  • Independent review waived by the release owner. Broad CI remains required. This does not claim to resolve the separate Bun session-authorization failure or fully qualify the beta.

Commands: OPENCLAW_VITEST_RUNTIME=bun pnpm test src/plugins/runtime.retention.test.ts src/plugins/plugin-native-admission-recovery.test.ts src/plugins/plugin-generation-artifact.native-reference.test.ts --maxWorkers=1; node scripts/run-oxlint.mjs --tsconfig tsconfig.core.json src/plugins/plugin-generation-source-lookup.ts; NODE_OPTIONS=--max-old-space-size=12288 pnpm tsgo:core.

@clawsweeper

clawsweeper Bot commented Nov 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.

@RomneyDa
RomneyDa enabled auto-merge (squash) November 17, 2026 11:43
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@RomneyDa
RomneyDa merged commit 234be12 into main Nov 17, 2026
123 checks passed
@RomneyDa
RomneyDa deleted the fix/plugin-recovery-host-context branch November 17, 2026 11:51
RomneyDa added a commit that referenced this pull request Nov 17, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…200374)

* fix(plugins): keep reload recovery metadata off the Gateway thread

Move the complete asynchronous recovery copy into the existing capture
broker, including root creation, copy filtering, native link validation,
and cleanup. Reuse one physical copy algorithm for the retained sync fork.

Follow up on #198262 and Wes (@akmad)'s original #181491 recovery work.
Preserve the independent native leases established by #200320.

A synthetic two-second create delay reduces the median MAIN heartbeat
gap from 2010 to 10 ms. Cold owner time rises 94.750 to 124.388 ms;
that cost and the remaining synchronous fork/import contracts are recorded
in the PR evidence. No configuration or schema changes.

* fix(tooling): include recovery imports in the PR wrapper

* test: prepare runtime build graph workers before test launch

A cold full Vitest worker compilation took 76 seconds inside the first 60-second heartbeat build-graph test. Enroll this selection in the existing runner preparation owner; preserve graph selection, test limits and assertions. Direct and projects runner regressions fail before the correction and all 55 runner cases pass afterward. Changed checks retain only the previously attributed Slack/UI dead exports.

* test: provide compiler artifacts for eager tooling admission

Use the existing controlled compiler for the unrestricted tooling selection. The eight-case admission table reproduces the missing manifest before this fixture migration and passes after it; retain the compiler count, receipt and selection assertions. No production behavior or timeout changes.

(cherry picked from commit 5275f43)
Co-authored-by: RomneyDa <[email protected]>
Release adaptation: apply after #200320 native capture owner prerequisite; retain source recovery copy and regression contracts unchanged. Follow-up #200571 detaches the independent owner from retired caller context.:
(cherry picked from commit b1d97f0a472874e12bbfb3a0e429f97f509d3710)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 234be12)
(cherry picked from commit 30ae600da1aaebb06df60250603c8c6d0ce30a64)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
Co-authored-by: vincentkoc <[email protected]>
(cherry picked from commit 2ea3a17)
Co-authored-by: RomneyDa <[email protected]>
Release adaptation: complete #200571 retention fix by detaching both native source descriptor and owner ports from all caller async context.:
(cherry picked from commit 58ba944c504995114aca3b7c358aeb22263b1fd8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant