Repository navigation
perf(plugins): retain settled migration readiness - #178323
Conversation
Read the live migration ledger through the shared-state read worker and reuse its readiness across plugin metadata owners. Invalidate only on committed deferred-migration writes, while preserving explicit snapshot inspection and the retained-data registration gate from #178165. Co-authored-by: Dallin Romney <[email protected]>
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR retains plugin migration readiness across metadata generations and unrelated writes using a migration-owner receipt. Example: Doctor completes pending-data-fixture’s migration, then an unrelated machine-state setting changes.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the optimization is useful, but interrupted migration commits can leave retained readiness stale and bypass the migration gate. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe plugin loader reads migration obligations before evaluating replacement plugins; Doctor owns migration completion, and database admission carries invalidation facts between workers. flowchart TD
A[Plugin preparation] --> B[Readiness cache]
B --> C[Shared state read worker]
C --> D[Migration ledger]
E[Doctor migration writer] --> D
E --> F[Admission receipt]
F --> B
B --> G[Plugin registration gate]
Technical reviewBest possible solution: Retain owner-scoped readiness while making migration receipts invalidate safely when a worker loses settlement after a durable commit. Do we have a high-confidence way to reproduce the issue? Current-main source invalidates readiness after unrelated writes or metadata-owner changes, and the supplied regression reports a matching base failure; no target code was executed during this review. Is this the best way to solve the issue? Reusing the existing read worker and migration owner is a focused solution, but receipt invalidation must also cover interrupted settlement rather than only successful publication. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7ad64520b5a2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +28, Tests +130, Docs +2. Total +160 across 5 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 20, 2026, 6:09 AM ET / 10:09 UTC. |
Read ordinary deferred-plugin readiness through the live state read worker and retain results under the migration owner's process receipt and database engine. Invalidate on committed ledger changes while preserving the pending-data registration gate and explicit snapshot scopes. Three alternating baseline/candidate pairs reduce the readiness family from 226 SQL statements / 42 requests / 5 MAIN statements to 41 / 10 / 0. Warm causal work stays 46 / 11 / 0. Retain one cold read per Gateway/catalog isolate; unrelated state writes no longer discard settlement. Preserve and extend the retained-data migration regression from openclaw#178165. 162 focused tests, PostgreSQL conformance, static CI, two isolated reviews and the published-driver update check pass. Record the source-key namespace guarantee for session-import recovery. Co-authored-by: Dallin Romney <[email protected]>
What Problem This Solves
#178165 correctly prevents plugins from registering before their retained-data migrations finish. Its readiness checks also sent ordinary runtime preparation through artifact-preserving database snapshots and discarded cached results after unrelated state writes or a new plugin metadata owner. That introduced repeated snapshot setup/copy/cleanup and main-thread SQL during runtime preparation.
Ordinary readiness now uses the existing live read worker and retains its result under the deferred-migration owner's process-lifetime admission receipt plus database-engine identity. Committed migration writes retire the receipt; unrelated state writes and ordinary database-handle closure do not. Receipt publication uses the existing commit/rollback and worker propagation owner. Pending migrations still block registration and direct operators to Doctor.
This replaces the metadata-owner/global-write-token cache and removes the snapshot path from ordinary readiness. No schema, SQL text, transaction ordering, or migration-gate change. Explicit artifact-preserving, maintenance and existing-schema inspections keep their separate read contract. A source-key comment documents why session-import recovery cannot write deferred-migration ledger rows.
Measurement
Frozen harness v3.1, three alternating base/candidate pairs (M,C,M,C,M,C), each with the full 300-second connected-idle interval and restart. Base
9f662f896dcf3a7dea8f4a01d198024acab75bff; measured implementation5e673e7fe4b0587e9b9f50d61e2a347254fc8f8d. Final head03fbc607cb302d6f926ca1a4855ffb7168249f1badds only the source-key comment, so runtime measurement and update evidence are reused unchanged.Counts are SQL / worker requests / MAIN, with median [min–max].
Readiness saves 185 statements, 32 requests and all five runtime MAIN statements in every pair. Its operation breakdown is:
The remaining 41/10/0 comprises the pre-existing metadata snapshot family (36/6/0), four cold ledger SELECTs and one ordinary quarantine-admission SELECT. The result cache is isolate-local: Gateway and catalog-worker each read once, then repeat after process restart. First turns, spawned sessions, cron and restart-first turns issue zero readiness SQL after initialization. The synchronous cold CLI/compute-worker adapter remains.
Shared read-family medians are unchanged: exact-entry 18 SELECTs, actor hydration 10, entry-cache snapshots 7, watermark 4, and row-facts operations 27 statements. All five families have zero warm causal statements in every arm. C1 alone had one extra exact-entry SELECT during spawn (19 versus 18); C2/C3 matched the baseline.
Outside readiness, each candidate recorded one extra maintenance preparation (21/4 → 24/5) and metadata maintenance operation (8/4 → 10/5): +5 SQL/+2 requests, outside warm turns. ACP metadata requests changed 1 → 2; scan requests had medians 5 → 6 (candidate range 4–6). Entry-patch SQL fell 173 → 171 and usage-cost SQL 22 → 21. These are disclosed workload differences, not additional savings claimed for this patch. The net measured workload still falls 183 SQL/28 requests/5 MAIN; the fixed readiness-family reduction is the causal claim.
Evidence
03fbc607cb30.Accepted boundaries: process reuse relies on sole-live-writer/root custody. Explicit maintenance remains outside the live cache. A migration committed after a captured read retires that receipt for subsequent preparation; no new cross-thread handshake, generation counter or freshness probe is added. Whole-workload totals include background scheduling and conditional install-status work; the fixed readiness delta is the attributable claim. No latency claim.
Production +48/−19 (net +29, including the ownership comment); tests +131/−1; docs +2. The small receipt mechanism removes repeated database work while retaining the data-safety gate.
Thanks @RomneyDa for the retained-data migration gate and safety regression in #178165.