Skip to content

feat: drain plugin work before removing Claw packages - #145649

Merged
steipete merged 2 commits into
mainfrom
codex/plugin-claw-removal-20260912
Sep 12, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/plugin-claw-removal-20260912

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

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 commit 518125d1e6d31132d46be7db61bb996f8a4c671a. 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 commit 39d890f15115f240859da02fe56e5eb09ea090c6, 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 commit d551ba216ff11c7c72d899b2ec003f81a55c94a4 is based directly on that landed commit and keeps exactly the same 24-file patch and payload bytes as validated 39d890f15115f240859da02fe56e5eb09ea090c6. 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 b8d012c716d1ad58e625f459ec9558e3068f56e9 passes all 134 jobs in CI run 34679494998. The only post-rebase correction regenerates the Android method catalog for claws.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.

@steipete steipete self-assigned this Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 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.

@steipete
steipete marked this pull request as ready for review September 12, 2026 05:30
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes size: XL maintainer Maintainer-authored PR labels Sep 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 3:05 AM ET / 07:05 UTC (Revision 5).

ClawSweeper review

What this changes

Claw 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
Reviewed head: b8d012c716d1ad58e625f459ec9558e3068f56e9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent owner-level repair with meaningful regression coverage and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored PR. Its body supplies source-qualified Linux observations of Gateway-owned removal; these remain historical evidence, not a pinned-head runtime pass. No unresolved authority violation requiring additional final-effect proof was established.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored PR. Its body supplies source-qualified Linux observations of Gateway-owned removal; these remain historical evidence, not a pinned-head runtime pass. No unresolved authority violation requiring additional final-effect proof was established.
Evidence reviewed 10 items Review continuity: Comparison with the previously reviewed d551ba2 shows only the generated ClawsPackagesRemove Android enum entry; the removal implementation is unchanged. The previous completed review supplied no findings.
Current-main necessity: Current main still invokes runPluginUninstallCommand with clawManaged enabled. That CLI owner deliberately bypasses Gateway delegation for closure-bound Claw callers, leaving this integration necessary.
Latest-release check: Inspection of v2026.9.4 confirms the same local uninstall call without runtime application; the requested handoff is not already shipped there.
Findings None None.
Security None None.

How this fits together

Claws 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +468, Tests +905, Docs +17, Other +1. Total +1391 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 14 521 53 +468
Tests 9 1018 113 +905
Docs 1 19 2 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 25 1559 168 +1391

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +468 lines; tests/support net +905 lines The stated production growth supplies the Gateway handoff and ownership-safe cleanup, with regression coverage concentrated on failures and cancellation.
Operator surface 1 administrative RPC; 0 new CLI flags or config options Existing removal selections use the new handoff without adding another user configuration surface.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This repairs selected Claw package removal with limited scope and no demonstrated urgent production outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this maintainer-authored PR. Its body supplies source-qualified Linux observations of Gateway-owned removal; these remain historical evidence, not a pinned-head runtime pass. No unresolved authority violation requiring additional final-effect proof was established.

Evidence

What I checked:

Likely related people:

  • steipete: 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-12T05:37:44.433Z sha 5491f86 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T05:59:52.117Z sha 9ac67b2a22561ddc14637fc8eb0069cc5d736834 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T06:26:41.383Z sha d551ba2 :: blocked before merge. :: none
  • reviewed 2026-09-12T06:36:54.434Z sha d551ba2 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/plugin-gateway-restart-free-20260911 branch from 8147a68 to 562c82c Compare September 12, 2026 05:42
@steipete
steipete requested a review from a team as a code owner September 12, 2026 05:42
@steipete
steipete force-pushed the codex/plugin-claw-removal-20260912 branch from 5491f86 to 9ac67b2 Compare September 12, 2026 05:51
Base automatically changed from codex/plugin-gateway-restart-free-20260911 to main September 12, 2026 06:13
@openclaw-barnacle openclaw-barnacle Bot added app: android App: android app: web-ui App: web-ui scripts Repository scripts commands Command implementations agents Agent runtime and tooling plugin: file-transfer plugin: team-reports labels Sep 12, 2026
@steipete
steipete force-pushed the codex/plugin-claw-removal-20260912 branch from 9ac67b2 to d551ba2 Compare September 12, 2026 06:19
@openclaw-barnacle openclaw-barnacle Bot removed app: android App: android app: web-ui App: web-ui scripts Repository scripts commands Command implementations agents Agent runtime and tooling labels Sep 12, 2026
@openclaw-barnacle openclaw-barnacle Bot added the app: android App: android label Sep 12, 2026
@steipete
steipete merged commit 1827410 into main Sep 12, 2026
193 checks passed
@steipete
steipete deleted the codex/plugin-claw-removal-20260912 branch September 12, 2026 07:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 12, 2026
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
steipete added a commit that referenced this pull request Sep 12, 2026
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
steipete added a commit that referenced this pull request Sep 12, 2026
* 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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
* feat(claws): remove plugin requirements through the serving Gateway

* build: generate Claw package removal method
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
…#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

1 participant