Repository navigation
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. What this changesThis PR adds redacted expired, replaced, or missing-row reasons to existing state-lease ownership-loss errors. Example: Another process replaces the core:plugin-lifecycle/global lease during plugin installation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a concrete diagnostic gap without changing lease ownership behavior; no actionable patch findings remain, though the CI gate is failing. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherPlugin lifecycle and maintenance callers use shared-state lease storage to verify ownership; failed checks become typed errors retained by CLI and recovery reporting. flowchart TD
A[Plugin install CLI] --> B[Plugin lifecycle lease]
B --> C[Lease storage]
C --> D[State lease table]
D --> E[Redacted loss classification]
E --> F[Existing error formatter]
F --> G[CLI failure receipt]
Technical reviewBest possible solution: Retain the focused classification at the existing storage and error owners while preserving lease rejection and recovery behavior. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically collapses missing, replaced, and expired rows into the same error; contributor evidence reports failing base regressions, and this read-only review executed no target code. Is this the best way to solve the issue? The patch is a small complete diagnostic repair using existing owners, with no competing state, new configuration, or unrelated production changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5181de212c10. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +59, Tests +101. Total +160 across 7 files. Added test files: 0. View PR surface stats
Review metrics
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 HistoryReview history (1 earlier review cycle)
Reviewed October 24, 2026, 11:57 PM ET / October 25, 2026, 03:57 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
OPENCLAW_STATE_LEASE_LOST reported the same generic message whether the lease expired, was replaced by another owner, or no longer existed, so Windows update repairs that failed with a lost plugin lifecycle lease (#182476) could not be diagnosed. The lease owner now classifies the loss as expired, replaced or missing from the persisted row and carries that reason through the error and the update failure report. Lease duration, renewal cadence, fencing and ownership are unchanged. Fixes #183154. Thanks @ooiuuii for the report and the diagnostic-only fix in #183178. Co-authored-by: luyifan <[email protected]>
|
Thank you, @ooiuuii! This landed as #183279 (9db139f). |
OPENCLAW_STATE_LEASE_LOST reported the same generic message whether the lease expired, was replaced by another owner, or no longer existed, so Windows update repairs that failed with a lost plugin lifecycle lease (openclaw#182476) could not be diagnosed. The lease owner now classifies the loss as expired, replaced or missing from the persisted row and carries that reason through the error and the update failure report. Lease duration, renewal cadence, fencing and ownership are unchanged. Fixes openclaw#183154. Thanks @ooiuuii for the report and the diagnostic-only fix in openclaw#183178. Co-authored-by: luyifan <[email protected]>
Closes #183154. Related to #182476.
What Problem This Solves
Native state-lease renewal and ownership verification collapse three persisted loss states into the same
OPENCLAW_STATE_LEASE_LOSTmessage: expired lease, replacement owner, and missing row. A failed update/repair can therefore retain a correct refusal but not the evidence needed to diagnose why it happened.User Impact
Lease-loss receipts now include a safe reason when the database supports one:
The replacement owner token is never included. Error codes, lease duration, renewal cadence, acquisition, ownership, fencing, cleanup, and recovery behavior are unchanged. Existing callers that only match the established message prefix retain it.
Why This Change Was Made
An observed Windows
2026.10.7update repair spent 1,427,442 ms in final Doctor and 637,736 ms in plugin finalization, then retained onlyplugin lifecycle lease core:plugin-lifecycle/global was lost. That receipt could not distinguish event-loop starvation from a competing owner or missing state.After a failed renewal, this change reads the row inside the same write transaction. Ownership verification uses the same database read boundary. A small structured reason is passed to the existing error owner, which formats only elapsed timing or a redacted state classification. If timestamps are incomplete or the row cannot support a safe conclusion, the existing generic message remains.
This follows the diagnostic-only approach used by #170835 and #154878: it makes the next incident actionable without claiming to fix the long-running work that caused the lease loss.
Evidence
state lease synthetic/diagnostics was lost.696f70f31, the focused state-lease diagnostics file passed: 1 file / 14 tests, including renewal and verification for all three loss states. The related worker regression set also passed with the repository unit config: 3 files / 23 tests.git diff --checkpassed.Real behavior proof
OPENCLAW_STATE_LEASE_LOST, including the receipt retained by update repair.10.0.26200.x, OpenClaw2026.10.7, Node.js26.12.1. The after-fix source proof ran on macOS against current main plus this patch with Node.js24.22.1and a real temporary OpenClaw SQLite state database.renewOpenClawStateLease()andverifyOpenClawStateLeaseOwnership()throughsrc/state/openclaw-state-lease-diagnostics.test.ts. Regression command:/tmp/openclaw-node-runtime/bin/node node_modules/vitest/vitest.mjs run --config test/vitest/vitest.unit.config.ts src/state/openclaw-state-lease-diagnostics.test.ts src/state/openclaw-state-lease-worker.test.ts src/state/openclaw-state-lease-worker.transaction-group.test.ts.Test Files 3 passed (3);Tests 23 passed (23); completed in 16.34 s. Type proof:./node_modules/.bin/oxlint --type-aware --type-check --deny-warnings <seven changed files>exited 0.Shipped CLI proof added after review
1aa0cb7856fd09e5cf5fc6bc36b2cd3f7ffbced7;node openclaw.mjs plugins install --link ./test/fixtures/web-output-provider --force --no-enable --accept-capabilitiesreportedOpenClaw 2026.10.7 (1aa0cb7)from the shipped CLI bootstrap.HOMEandOPENCLAW_STATE_DIRdirectories, a repository fixture plugin, and no real account, Gateway, credentials, or network endpoint.core:plugin-lifecycle/globalrow, then changed only its owner to a synthetic value. This reproduces replacement by another owner while the real CLI command is inside the production plugin-lifecycle lease path.