Repository navigation
feat: drain plugin work before removing Claw packages - #145649
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 3:05 AM ET / 07:05 UTC (Revision 5). ClawSweeper reviewWhat this changesClaw removal delegates selected plugin cleanup to the running Gateway, preserves cleanup outcomes and warnings, and guards skill rollback against changed ownership. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and the latest release lack the Claw-specific Gateway handoff. No actionable introduced defect was found, and the latest commit only completes the generated Android method catalog. Priority: P2 Review scores
Verification
How this fits togetherClaws install agents with package dependencies. Their removal command coordinates local cleanup with the Gateway, which owns active plugin work and must drain it before installed files disappear. flowchart TD
A[Removal preview and consent] --> B[Claw removal coordinator]
B --> C[Gateway package request]
C --> D[Validate current ownership and plan]
D --> E[Drain plugin work]
E --> F[Canonical package uninstall]
F --> G[Outcomes and runtime generation]
G --> B
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +468, Tests +905, Docs +17, Other +1. Total +1391 across 25 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep plugin drainage and uninstall under the serving Gateway’s existing lifecycle owner, with explicit selection, current-ownership checks and recoverable partial outcomes. Do we have a high-confidence way to reproduce the issue? Yes, from source: selected Claw plugin removal on current main bypasses Gateway delegation and invokes uninstall without runtime application. No live reproduction was executed in this read-only review. Is this the best way to solve the issue? Yes. The patch connects Claw cleanup to the existing leased uninstall and runtime owners while preserving selection rules and avoiding a competing local fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d7de5bc0ad52. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
8147a68 to
562c82c
Compare
5491f86 to
9ac67b2
Compare
9ac67b2 to
d551ba2
Compare
|
Merged via squash.
|
Restore native Bun dependency resolution, runtime-only refresh, channel status and cold-account handling. Return contention before Gateway plugin or Claw-package mutations start, retaining receipts for later failures. Keep slow service startup cleanup with its lifecycle owner, restore LanceDB service state on rollback, and retain CLI cleanup warnings. Remove obsolete generation retirement and duplicate package resolution. Related: #145484, #145649
Restore native Bun dependency resolution, runtime-only refresh, channel status and cold-account handling. Return contention before Gateway plugin or Claw-package mutations start, retaining receipts for later failures. Keep slow service startup cleanup with its lifecycle owner, restore LanceDB service state on rollback, and retain CLI cleanup warnings. Remove obsolete generation retirement and duplicate package resolution. Related: #145484, #145649
* fix(plugins): recover reloads and release retired resources Restore native Bun dependency resolution, runtime-only refresh, channel status and cold-account handling. Return contention before Gateway plugin or Claw-package mutations start, retaining receipts for later failures. Keep slow service startup cleanup with its lifecycle owner, restore LanceDB service state on rollback, and retain CLI cleanup warnings. Remove obsolete generation retirement and duplicate package resolution. Related: #145484, #145649 * test(gateway): verify startup capability reconnects with real sockets * fix(agents): release queued preparation before gateway retirement * fix(plugins): preserve cleanup ownership and machine-readable reloads * refactor(gateway): group reload recovery proof by lifecycle owner * fix(plugins): preserve require context on older Bun runtimes * fix(agents): return explicit queued cleanup completion
* feat(claws): remove plugin requirements through the serving Gateway * build: generate Claw package removal method
…#145816) * fix(plugins): recover reloads and release retired resources Restore native Bun dependency resolution, runtime-only refresh, channel status and cold-account handling. Return contention before Gateway plugin or Claw-package mutations start, retaining receipts for later failures. Keep slow service startup cleanup with its lifecycle owner, restore LanceDB service state on rollback, and retain CLI cleanup warnings. Remove obsolete generation retirement and duplicate package resolution. Related: openclaw#145484, openclaw#145649 * test(gateway): verify startup capability reconnects with real sockets * fix(agents): release queued preparation before gateway retirement * fix(plugins): preserve cleanup ownership and machine-readable reloads * refactor(gateway): group reload recovery proof by lifecycle owner * fix(plugins): preserve require context on older Bun runtimes * fix(agents): return explicit queued cleanup completion
Builds on landed #145484. Related: #135599
Additional instructions
Keep Allow edits from maintainers enabled.
What Problem This Solves
Fixes Claw removal with explicitly selected plugin cleanup deleting managed package files without first draining the serving Gateway's plugin work. Cleanup must keep unrelated plugins and the Gateway running, and preserve recoverable state when it cannot finish.
Why This Change Was Made
The CLI hands the package phase to the serving Gateway before taking package mutation leases. The Gateway revalidates the current deletion journal, install record, cleanup selection and config/state/scheduler binding, then uses the canonical leased uninstall owner. Skill compensation restores only its own staging and tracking while its package lease remains current.
The package owner returns one outcome containing package effects and warnings, retaining typed runtime failure facts for the existing runtime projector. This prevents a later committed failure from being reported with an earlier generation and preserves canonical uninstall warnings, including those emitted before failure. The shared cleanup normalizer gives omitted options the same identity after JSON transport; it leaves the general stable serializer unchanged. Partial CLI results now display their recorded error and do not claim an agent was removed when it was not.
User Impact
Explicitly selected plugin removal withdraws new calls, drains admitted work, and then removes owned files and records without restarting the Gateway. Default global-plugin retention and explicit conflict consent remain supported. A failed handoff reports partial removal and preserves the deletion fence and recovery record; earlier completed effects are not rolled back, and the CLI does not fall back to a second local uninstall. A runtime replacement failure stops the remaining package phase and reports unattempted packages as retained; ordinary package errors continue best-effort cleanup. Earlier outcomes, warnings, and the actual committed runtime generation stay visible in partial results.
Evidence
On the initial real G parent
3cf609616b604e0fbe304114f01370c386a24486, 150 tests across eight full owner/entrypoint files passed; the nine-case JSON wire table was rerun after a test-only clarification. The skill rollback regressions failed on the original G owners, the JSON-roundtrip handoff cases failed before cleanup normalization, and the partial human-output case failed before the renderer correction. Existing tests cover stale journals/bindings/plans, request loss during drain, conflicting owners, real CLI parsing, and owned staging recovery. Two planner fixtures now exercise their intended drift checks, and typed removal fixtures share the existing test helper without raising line limits.Linux Testbox run 34641392785 passed a normal build and the original W14/C3/U2 scenarios on assembled product tree
18b3d63c20bd444aab64980c03ecf1c6132e4517, based on F commit518125d1e6d31132d46be7db61bb996f8a4c671a. Both U variants proved files retained until held work finished, withdrawn admission, actual selected removal, same Gateway/connection/sibling, and exactly one start/stop/dispose/held-completion callback. The warning variant emitted its warning once. Default retention was previewed only. This is qualified combined-source evidence, not a new execution of the eventual U head; the omitted-option and failure-rendering corrections have the local regressions above.Current candidate delta: production +521/-53 (net +468), tests/support +1018/-113, docs +19/-2. Growth implements serving-Gateway ownership and safe cleanup. No config option, SQLite schema or protocol-version change is introduced.
Targeted lint, formatting and diff checks passed. The initial full P2 review found the two outcome bugs above; their source-qualified REDs and corrections are retained. The fresh full corrected P2 review passed all three passes with no accepted/actionable P0–P2 findings against the exact candidate over published G3cf. The reviewed U commit was mechanically rebased onto Gateway feature commit
b53160a3574c6bb1ce5247e71beb169ab814dd4d. All 22 unaffected U files are byte-identical; the two method-list files match the native three-way merge, preserving the new session-storage methods. The canonical changed gate passed on rebased U commit39d890f15115f240859da02fe56e5eb09ea090c6, including production and test typing, unused-export checks, lint and guards. The 59 focused overlap tests passed: method listing, Claw removal ownership and deletion-journal fencing. The original P2 review remains qualified to its original G3cf capture; this is mechanical source-conformance and new-parent gate evidence, not a restamped review. A new local full build was not run for the mechanical rebase; exact-head CI/build and publication remain pending.The Gateway foundation landed in #145484 as
b5134de70af88e342accaba665590c7cb6b79f0b. U commitd551ba216ff11c7c72d899b2ec003f81a55c94a4is based directly on that landed commit and keeps exactly the same 24-file patch and payload bytes as validated39d890f15115f240859da02fe56e5eb09ea090c6. Its whole-tree changes are precisely the inherited parent changes. None of the U-owned files or its 26 direct critical owners changed. The connected-owner audit verified that incoming allocation refactors preserve live registry and captured-source membership and leave plugin admission, drainage, and disposal unchanged; session cleanup only drops an unused query field. The 59 overlap tests and 552-second changed gate remain qualified to the earlier validated source; they were not rerun for this mechanically identical U payload. Exact-head CI and landing remain required.Final head
b8d012c716d1ad58e625f459ec9558e3068f56e9passes all 134 jobs in CI run 34679494998. The only post-rebase correction regenerates the Android method catalog forclaws.packages.remove; canonical protocol generation failed before that single generated entry and passes afterward, with a clean independent P2 review. Production implementation is unchanged. Earlier unrelated subagent fixture failures passed this run without weakening their assertions. Historical Linux behavior evidence above remains qualified to its recorded source.