Skip to content

perf(plugins): prepare cleanup migration policy under lease - #159338

Merged
steipete merged 1 commit into
mainfrom
codex/plugin-cleanup-policy-read
Sep 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/plugin-cleanup-policy-read

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

After plugin replacement, each source-cleanup policy check rereads deferred migration rows from SQLite on the caller thread. The batch already holds the lease that excludes their writers.

User Impact

Cleanup prepares those migration rows through the existing worker while retaining the plugin lease. Every existing guard still reads current config files, included files and environment substitutions, and retains its source identity and durable lease checks. The public synchronous policy reader, stored formats and update behavior stay unchanged.

Why This Change Was Made

The batch reacquires plugin custody after runtime activation, awaits its migration rows, and checks authority again. Only private cleanup wrappers receive those rows. The config owner consumes them while rebuilding its config view for every guard. This avoids retaining a stale config verdict or assuming that a root config lock covers external edits and shared includes.

Evidence

Exact candidate df43b924 passed 77 tests across seven focused plugin, Claw and config files. The changed batch file passed all 19 cases. On original main 038b10b4, the same test file produced exactly five intended failures: three missing policy-read handoffs and two caller-thread migration queries; the other 14 cases passed. The full focused invocation took 430.81 seconds on the loaded development host, including 33 seconds of worker preparation; the 19 batch cases' reported durations total 276.829 seconds. These are validation timings, not a performance benchmark.

The actual published [email protected] updater installed this separately built candidate successfully. The installed CLI then performed a real Git-to-ClawHub plugin replacement through a Claw requirement and genuine PTY confirmations. Version 2 activated in the same Gateway PID before the retired Git tree was removed. Exact installed payload, archive integrity, ledger ownership, unrelated state, workspace bytes, SQLite integrity and schema checks passed. Candidate tarball SHA-256: 97b85deddc1cf77e9d22d137e4193d810300b34aef904664be635803531a810b. The Testbox run hosted the cell; its command exited zero. The full private proof and package are retained.

Exact-head CI passed 130 jobs with 20 skips; checkout b41f2df3 combines this head with main 61ff4469. Independent source review found no actionable finding. Four earlier wrapper attempts stopped during source sync before tests; native debug isolated the generated-bundle transfer path. The supported installed Crabbox CLI then synchronized the clean exact candidate and ran the cell with a normal frozen install. No sync bypass, timeout change, provider change, or prior candidate result was used.

@clawsweeper

clawsweeper Bot commented Sep 27, 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 size: S labels Sep 27, 2026
@steipete
steipete marked this pull request as ready for review September 27, 2026 02:48
@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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 12:04 AM ET / 04:04 UTC (Revision 2).

ClawSweeper review

What this changes

During plugin replacement, the branch reads deferred migration rows through a worker while holding the plugin lease, passes them to fresh source-cleanup checks, and updates regression tests and worker-access documentation.

Merge readiness

✅ Ready for maintainer review

Current main still queries deferred migration rows synchronously during plugin source cleanup. The merged companion PR addressed the installed index, leaving this repair distinct. No actionable patch defect was found, and the new upgrade evidence addresses the prior proof request.

Priority: P2
Reviewed head: df43b924cc52dc2a6a80125e5ffd88bacfb2a419

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused repair has meaningful negative controls, exact-head CI, and specific reported installed-updater behavior, with no actionable source finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The changed plugin-batch cleanup is tied to a reported run of the published 2026.9.4 updater and installed CLI: a Git plugin was replaced through a Claw requirement, version 2 activated in the same Gateway process, and the retired tree was removed after checks. The linked exact-head Testbox wrapper ended cancelled after the contributor-reported successful cell; its underlying log was blocked by the review proxy. The patch changes no stored-data format, so data-model compatibility is not applicable.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The changed plugin-batch cleanup is tied to a reported run of the published 2026.9.4 updater and installed CLI: a Git plugin was replaced through a Claw requirement, version 2 activated in the same Gateway process, and the retired tree was removed after checks. The linked exact-head Testbox wrapper ended cancelled after the contributor-reported successful cell; its underlying log was blocked by the review proxy. The patch changes no stored-data format, so data-model compatibility is not applicable.
Evidence reviewed 12 items Current main retains the synchronous read: The cleanup guard on current main calls the synchronous policy reader for each source check.
Synchronous reader queries migration rows: The policy reader on current main invokes the synchronous deferred-migration reader before loading config.
Introduced worker handoff: The branch awaits migration rows while holding the cleanup lease, checks ownership again, and supplies those rows to cleanup.
Findings None None.
Security None None.

How this fits together

A plugin replacement batch receives committed install records and a runtime activation result. Before removing the old source, it checks the installed index, pending migrations, current config, source identity, and plugin lease.

flowchart LR
A[Plugin replacement] --> B[Runtime activation]
B --> C[Cleanup lease]
C --> D[Worker reads index and migrations]
D --> E[Live config and source checks]
E --> F[Retain or remove old source]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +20, Tests +83, Docs +2. Total +105 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 27 7 +20
Tests 1 91 8 +83
Docs 1 9 7 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 127 22 +105

Review metrics

Metric Value Why it matters
Production and test delta production +27/-7; tests +91/-8 The production growth is confined to the private worker handoff; the tests cover cleanup custody and changing policy inputs.
Reported regression comparison 5 intended baseline failures; 19 candidate batch cases passed The comparison targets the original synchronous-read behavior and the changed batch boundary.

Technical review

Best possible solution:

Keep source retirement bound to current lease ownership and fresh config and filesystem checks, while obtaining migration facts through the existing worker.

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

Yes, by source: current main calls the synchronous migration reader from each cleanup guard, and the PR reports five targeted failures on its original main baseline. This read-only review did not execute the tests.

Is this the best way to solve the issue?

Yes. The existing worker and plugin lease remove repeated caller-thread migration queries while preserving live config and source checks at deletion.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4c88390c72d7.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed plugin-batch cleanup is tied to a reported run of the published 2026.9.4 updater and installed CLI: a Git plugin was replaced through a Claw requirement, version 2 activated in the same Gateway process, and the retired tree was removed after checks. The linked exact-head Testbox wrapper ended cancelled after the contributor-reported successful cell; its underlying log was blocked by the review proxy. The patch changes no stored-data format, so data-model compatibility is not applicable.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: Repeated caller-thread SQLite work affects plugin replacement cleanup, with a bounded performance impact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The changed plugin-batch cleanup is tied to a reported run of the published 2026.9.4 updater and installed CLI: a Git plugin was replaced through a Claw requirement, version 2 activated in the same Gateway process, and the retired tree was removed after checks. The linked exact-head Testbox wrapper ended cancelled after the contributor-reported successful cell; its underlying log was blocked by the review proxy. The patch changes no stored-data format, so data-model compatibility is not applicable.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed plugin-batch cleanup is tied to a reported run of the published 2026.9.4 updater and installed CLI: a Git plugin was replaced through a Claw requirement, version 2 activated in the same Gateway process, and the retired tree was removed after checks. The linked exact-head Testbox wrapper ended cancelled after the contributor-reported successful cell; its underlying log was blocked by the review proxy. The patch changes no stored-data format, so data-model compatibility is not applicable.

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)
  • Dallin Romney: 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 (1 earlier review cycle)
  • reviewed 2026-09-27T02:54:48.683Z sha df43b92 :: blocked before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The requested runtime and upgrade evidence is now complete for unchanged head df43b924cc52dc2a6a80125e5ffd88bacfb2a419; the PR body records the results and timings.

The exact candidate passed 77 focused tests across seven files, including all 19 batch cases. The same regression file on original main 038b10b4 failed exactly five intended cases: three missing policy-read handoffs and two synchronous migration-row queries. The other 14 cases passed. The focused invocation took 430.81 seconds including worker preparation; reported batch case durations total 276.829 seconds on the loaded host.

The actual published 9.4 updater installed the newly built candidate, then the installed CLI completed the real Git-to-ClawHub Claw requirement with genuine PTY confirmations. The same Gateway PID activated version 2 while the old Git tree still existed, and cleanup then removed that tree. Payload identity, archive integrity, ledger ownership, unrelated state, workspace, SQLite integrity and schema checks passed. No provider inference or provider credentials were used by the synthetic fixture. Testbox run: https://github.com/openclaw/openclaw/actions/runs/36291423102 (cell exit 0).

Candidate tarball SHA-256: 97b85deddc1cf77e9d22d137e4193d810300b34aef904664be635803531a810b. Retained proof archive SHA-256: 329aaafea83f6ff1544c05d792fd22ffadaaeccca9a528e92ae84f86ea7ca9b6. Exact-head CI remains green. Earlier source-sync failures remain documented and are not counted as executed proof.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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. labels Sep 27, 2026
@steipete
steipete merged commit e1b0d1f into main Sep 27, 2026
294 of 295 checks passed
@steipete
steipete deleted the codex/plugin-cleanup-policy-read branch September 27, 2026 04:14
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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