Repository navigation
fix(plugins): release idle workers after preparing bundled state operations - #206172
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
vincentkoc
marked this pull request as ready for review
November 26, 2026 21:03
Member
Author
|
Merged via squash auto-merge.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 27, 2026
…ations (openclaw#206172) * fix(plugins): retire preparation workers for bundled state operations * chore(plugins): place the capture handoff invariant at its assertion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #192547
What Problem This Solves
A Gateway that prepares bundled state operations can keep a JavaScript worker alive until the plugin registration closes. In a one-CPU ARM64 Gateway with the default memory plugin, the preparation worker held nine callable handles and had no pending calls at readiness, in the first chat handler, and at acknowledgement. The worker remained alive through the following 60-second soak. Its physical V8 heap was 32.5 MiB in the 2 GiB reference service. That figure measures the worker heap. The 768 MiB service has a separate first-reply test. Gateway measurements
User Impact
The Gateway can retire the last preparation worker before the first late state operation. Registered operations continue using their admitted code and dependencies after installed files change or disappear. An independent borrower keeps the shared worker until it releases its own capture. An in-place edit to an already loaded bundled export still requires a Gateway restart.
Why This Change Was Made
The preparation worker owned the final copy of the selected operation graph. The host now transfers the same captured file facts, module lookups and native leases, and makes that final copy directly into an independent recovery claim. It releases the source worker after the transfer completes. Failed replies and synchronous binding cleanup both join physical resource disposal. The change applies to immutable bundled state-operation captures. External-plugin preparation retains its existing ownership and timing. Related external-plugin experiment
Evidence
ee4061ce, both async loader cases observed a live preparation worker at first use. Both synchronous controls passed. Onb6e51224, seven focused suites passed all 90 tests, including first invocation after file removal, replacement registration, scoped and unscoped capture, native files, recovery, unexpected worker exit, and final teardown. The lost-reply and pending-close controls each failed independently on the respective pre-fix implementation. The plugin-platform TypeScript check and typed lint passed. Linux x64 proof hostee4061ce..b6e51224with no listed risks or open questions. The signed successor2417dad8moves one existing ownership comment immediately above its type assertion. Executable source lines match the testedb6e51224exactly. The repository’s assertion guard counted 0 uncovered assertions onee4061ce, 1 onb6e51224, and 0 on2417dad8. Local ClawSweeper also completed the successor range. Production changes add 137 lines and remove 45. Tests add 183 and remove 8.