Repository navigation
fix: update repair clears abandoned handoff leases - #160488
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 real behavior proof before merge. Reviewed October 1, 2026, 12:13 AM ET / 04:13 UTC (Revision 14). ClawSweeper reviewWhat this changesThe PR extends update repair to reclaim abandoned installation handoffs, preserve recovery evidence in SQLite, and record settlement before releasing ownership. Merge readiness⛔ Blocked before merge - 9 items remain This PR remains necessary: current main supplies process-census support but lacks explicit handoff recovery. All three prior findings remain supported by the pinned head. Likely related people: steipete and fuller-stack-dev are relevant routing candidates (low confidence). Priority: P0 Review scores
Verification
How this fits togetherUpdate handoffs prevent competing processes from changing the same installation. Explicit repair combines recorded update history, process identities, and retained artifacts to recover ownership and allow later updates. flowchart TD
A[Explicit update repair] --> B[Recorded handoff and update history]
B --> C[Owner and artifact custody checks]
C --> D{Safe to claim?}
D -->|No| E[Keep evidence and explain refusal]
D -->|Yes| F[Finalize current installation]
F --> G[Record settlement and release lease]
G --> H[Admit next update]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The new recovery authority lacks a final artifact-custody check; no dependency or unrelated supply-chain change was found. PR surfaceSource +474, Tests +1277, Docs +38, Config 0. Total +1789 across 24 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep recovery in the existing handoff owner, preserve generation-bound evidence through refused settlement, and verify safe recovery from published-updater state. Do we have a high-confidence way to reproduce the issue? Yes, source establishes focused triggers: introduce a matching borrower after preparation, refuse release after closing, or repair a dead running triage lease without metadata. These paths were inspected but not executed during this read-only review. Is this the best way to solve the issue? The existing handoff owner is the right repair boundary, but the proposed settlement lifecycle still loses custody freshness and retryability. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b58f2a2c3327. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (13 earlier review cycles; latest 8 shown)
|
1725f91 to
ec9c669
Compare
f30c47f to
9586e1f
Compare
ec9c669 to
1b25aa7
Compare
9586e1f to
10a8d83
Compare
1b25aa7 to
5c0339e
Compare
b379b35 to
eada642
Compare
0650877 to
5e56841
Compare
Process-census capability needed to distinguish a dead managed-service handoff owner from a surviving descendant: a Windows process census (PID, start identity, command line, cwd, owner SID with the foreign-owner rule from the Unix contract), verified Unix UID provenance for incomplete observations, and retained-artifact reference matching that reports matching versus unverified PIDs. Existing callers keep their classification when the new evidence is absent. Refs #159897 (the reclaim itself follows in #160488). Landed under the pre-existing-red rule: the remaining CI failures were current main reds in the merge window (fast-lane config expectation fixed by e0ec544; cron service tests fixed by 5f76cc4; update-candidate-canary from b36eb3e).
a2707bc to
6441a7f
Compare
c40c7c8 to
c18d175
Compare
|
Landed via the admin exception for an inherited failure (squash Inherited failure on the PR head: |
…evidence (openclaw#160488) The managed-service handoff lease owner retained an uncertain foreground handoff forever: a dead handoff owner's lease could never be reclaimed and no repair path could establish descendant absence, so updates ended in reconcile:abandoned and operators had to intervene by hand. Reclaim now uses process-census evidence (unverified or unresolved census vetoes), generation-bound metadata on the existing handoff table (nullable additive columns, same store version, lazy idempotent ensure), an atomic ownership claim, failed-repair retention, and a settlement receipt recorded before release; openclaw update repair has an explicit reclaim admission; reboot reclamation preserves generation-bound repair metadata; a state-override path that could bypass the fail-closed admission is closed. Legacy rows without metadata are reclaimed only after a 45-minute floor plus the census. Closes openclaw#159897 Refs openclaw#159909, openclaw#161090, openclaw#161721, openclaw#161761
Closes #159897
Refs #159909
Thanks to @taihartman for the Windows report. The process-census capability (#160292) is on main; this PR owns handoff recovery.
What Problem This Solves
Fixes later updates remaining blocked when automatic triage leaves an uncertain handoff after its updater and helper exit.
User Impact
Explicit
openclaw update repaircan settle the abandoned handoff and admit the next update. It requires both recorded PID/start identities to be provably dead, a readable original run in the selected state database, a complete census without matching or unverified processes, and at least 45 minutes since recorded lease activity, raised by any larger recorded timeout. Refusals explain the next step and identify live or unverified processes when applicable.Use the failed update's original profile and state overrides. An artifact's run ID alone cannot bypass rollback checks by selecting a different state database. Incomplete rollback retains its generation and artifacts; completed rollback can finalize the restored installation, including headless installs. Gateway startup and borrowed updater processes do not reclaim these leases.
Why This Change Was Made
The existing handoff owner correlates retained artifacts and timeouts, checks process evidence, and claims the exact generation transactionally. Failed repair retains generation-bound evidence across reboot. Successful finalization records and verifies settlement before closing and releasing ownership. Capture/native recovery stays with its existing owner; skipped steps and optional Git-branch cleanup do not strand completed rollback.
The additive schema adds bare nullable
recovery_json TEXT, declared canonically and ensured once on first use. Store version and original payload bytes stay unchanged. Downgrade tests execute old named-column SELECT/INSERT/UPDATE operations against the additive schema. Metadata version 3 is distinct from native-custody payload version 3.The architecture correction puts the borrowed legacy-parent type in the existing leaf contract and gives reclamation only the lease operations it consumes. This removes both Madge cycles without a runtime shim, extra module, or duplicated state owner. The subsequent P1 finding about missing original history was fixed in the same fact reader before any claim.
Production is +474 net LOC, within the approved +475 cap;
lease.tsis 692 lines. Production: +552/−78. Tests/support: +1,324/−47; docs: +38. No new configuration/CLI options, dependencies, suppressions, or baseline edits.Evidence
Fresh direct-route Codex P1 verdict: scoped-clean — no accepted/actionable findings, both review passes, exit 0.
Accepted pre-rebase head:
c40c7c8d0557c12f3749cb42ea258f4a771655eb, rebased onto098173f9f5d47c211541f5bd9595414ed1aeb15d(includesba80dfbee5a4). Blacksmith Testboxtbx_01m3tpg7189d9gfw56cxy0mf9e(run) fetched that exact SHA and installed withpnpm install --frozen-lockfile; no local tree sync was used.Final command output:
pnpm check:import-cycles, fullpnpm check:architecture, and core typechecking passed. The final two owner suites passed 3×; all seven cleanup importers passed once. Each owner pass had 48/48 tests; importer proof had 179 passed and five existing skips. The negative control failed for the intended reason: before the guard, repair returned a claim from another state directory while the original ledger retained an incomplete rollback. The fixed case preserves the original lease and history. No new process-family launch was added.On the preceding architecture candidate
6441a7fd8577b4caf4db21fc55cb4cd581b27b11, the pre-fix control reproduced both reported Madge cycles; the structural fix reduced them to zero. Eight owner suites passed 3× (108 passed and one existing skip per pass), and the remaining 58 importers passed. The later state-context correction reran its affected suites and all architecture checks on the final head.Earlier full
node scripts/check-changed.mjsproof passed ona2707bc6b3341bb2de06f6507c9bbaff6bbaf696. That command checked runtime-value cycles, while the CI architecture job additionally checked Madge's type-dependency graph. The current explicit architecture proof closes that gap.The captured-cwd case in
update-cli.target-schema.test.tspreviously failed identically 3/3 on pristine main80e24f2b1e626e352aebf1d4411cc6ffa4b5df5dand B4928642dfb46374c9a2ed08bb9e08d4053d0cacd. It is a documented inherited failure; the file was not edited here and passed in the final replay.The approved Windows-plan bound is
<427for the rounded 426-second census/repair shard. It includes the earlier census adjustment plus the approved extra second; estimates and coverage were not lowered. Native Windows proof remains this PR's own Windows CI lane. Published-driver and Node-runtime live suites were not enabled. No product CI dispatches, reruns, or pushes solely for green were used. Auto-merge was not toggled.Named, waived follow-ups remain the existing fixture costs in
update-cli.test.ts(123 s),update-command-original-service.test.ts(144 s),update-command-lease.test.ts(132 s),update-managed-service-handoff-lifecycle.test.ts(246 s),triage-continuation.test.ts(123 s),update-managed-service-handoff-foreground.test.ts(44 s no-op case),package-acceptance-workflow.test.ts(191 s), andci-changed-node-test-plan.test.ts(194 s). No timeout, retry, or skip changes were used.Mechanical rebase closeout: current head
c18d175bfa188fccea28fb0fda3d1045aa2b8e6cis rebased onto main508e2069f83698ffc7d7671a89ceef01612ce91a. The exact conflicted-file list waspackage.jsononly. Resolution preserves main's metadata and Windows registrations plus all four handoff repair registrations. Range-diff confirms no behavior changes; the accepted P1 review carries forward under the lead's ruling.Blacksmith Testbox
tbx_01m3tt3nev5xv82r8zmj50cv0j(run) fetched the exact pushed SHA, installed withpnpm install --frozen-lockfile, and ranpnpm check:import-cyclesplus the 11 selected owner/tooling suites once. No local tree sync was used. All 11 files passed: 227 tests passed, one existing skip, 51.38 seconds across three Vitest shards. This includes the Windows plan tooling test. Output:Production remains +474 net LOC and
lease.tsremains 692 lines. Auto-merge was left unchanged. No CI reruns or dispatches were requested.