Repository navigation
fix(update)[2026.11.11]: recover timed-out and orphaned finalizers to a verified Gateway - #205758
Conversation
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
… deadline A default worker deadline terminated finalization into a pending recovery that leaves the managed Gateway stopped. Restore the explicit/inherited-only deadline until timeout recovery can verify a serving Gateway. Co-authored-by: RomneyDa <[email protected]>
…Gateway A finalizer stopped at its deadline left a pending recovery that the managed helper treated as an explicit refusal, and a killed waiting updater left its candidate worker holding the run's child lease, so the helper lost its claim. Both left the Gateway stopped until a manual update repair. Route the finalizer deadline into the helper's existing interrupted recovery, join a settling candidate worker within the recovery budget before reclaiming the claim, and restore the default finalizer deadline (an explicit --timeout still takes precedence). Recovery still requires an authenticated health RPC with the expected version and build. Refs #205547, #205675. Co-authored-by: RomneyDa <[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: blocked before merge. What this changesThis PR routes finalizer timeout results and orphaned worker leases into existing Gateway recovery, checks finalizer requester policy once, and requires RPC verification of recovery. Example: The waiting updater is SIGKILLed while its candidate Doctor worker still holds the child lease.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored release-line PR contains useful recovery work, preserves existing data-safety refusals, and has no established introduced correctness defect. Reviewed head: Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe release/2026.11.11 in-place updater delegates finalization to a candidate worker; its detached helper owns lease settlement, interrupted publication recovery, native Gateway startup, and terminal recording, while current-main owned installs use src/update/. flowchart TD
A[Update request] --> B[Detached managed helper]
B --> C[Waiting updater]
C --> D[Candidate finalizer worker]
D --> E[Child lease settlement]
E --> B
B --> F[Existing interrupted recovery]
F --> G[Gateway startup and RPC verification]
G --> H[Recorded terminal outcome]
Technical reviewBest possible solution: Complete validation of the focused legacy-helper repair while retaining explicit-only deadlines and existing data-risk refusals. Do we have a high-confidence way to reproduce the issue? The release-line source and submitted installed red control establish the orphaned-child lease failure; no reviewer-side execution occurred, and current-main owned-update routing differs. Is this the best way to solve the issue? Reusing the existing lease and interrupted-recovery owners is the smallest coherent repair; the unchanged hung-Doctor refusal remains outside this patch's fix scope. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1a660f87c7f0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +40, Tests +182, Docs +16. Total +238 across 21 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (3 earlier review cycles)
Reviewed November 26, 2026, 1:16 AM ET / 06:16 UTC (Revision 4). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…imeout Restoring an implicit finalizer deadline added a failure path that a healthy but slow update could hit (#153085 removed it for that reason), and its expiry is reported as update-recovery-pending, which the helper does not route into recovery. Drop it again: an explicit --timeout still bounds the worker, and its update-activation-timeout result enters the verified interrupted recovery. Refs #205547. Co-authored-by: RomneyDa <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
… a verified Gateway (#205758) * fix(update): admit migrated finalizer requester once * fix(update): bound migrated finalization and verify interrupted recovery * fix(update): require authenticated RPC in interrupted recovery wait * test(update): scope the migrated worker capability stub * test(update): keep the worker timeout stub typed * fix(update): keep migrated finalization unbounded without an operator deadline A default worker deadline terminated finalization into a pending recovery that leaves the managed Gateway stopped. Restore the explicit/inherited-only deadline until timeout recovery can verify a serving Gateway. * fix(update): recover timed-out and orphaned finalizers to a verified Gateway A finalizer stopped at its deadline left a pending recovery that the managed helper treated as an explicit refusal, and a killed waiting updater left its candidate worker holding the run's child lease, so the helper lost its claim. Both left the Gateway stopped until a manual update repair. Route the finalizer deadline into the helper's existing interrupted recovery, join a settling candidate worker within the recovery budget before reclaiming the claim, and restore the default finalizer deadline (an explicit --timeout still takes precedence). Recovery still requires an authenticated health RPC with the expected version and build. Refs #205547, #205675. * fix(update): keep migrated finalization bounded only by an operator timeout Restoring an implicit finalizer deadline added a failure path that a healthy but slow update could hit (#153085 removed it for that reason), and its expiry is reported as update-recovery-pending, which the helper does not route into recovery. Drop it again: an explicit --timeout still bounds the worker, and its update-activation-timeout result enters the verified interrupted recovery. Refs #205547. --------- (cherry picked from commit cc7f256) Release adaptation: Keep timeout classification with the existing interrupted-recovery admission in the result source; leave the handoff entry point at its baseline line count. Preserve authenticated readiness and the retained package-slot/installed-generation recovery. Later same-path commits from the pinned scan (separate behavior unless named as folded/selected below): f927fb1 #203406 reports explicit package recovery; 8bc37be #205850 and `020832b252e8` #205669 handle migrated channel owner admission; 31ea1c0 #206530 handles namespace-less Linux locks (separately deferred because explicitly superseded in pinned main).. Co-authored-by: RomneyDa <[email protected]>
Problem
On the 2026.11.11 in-place updater (the legacy migrated-finalizer path, which is not on
main;mainupdates go throughsrc/update/), two faults left the managed Gateway stopped until someone ranopenclaw update repair(#205547):update-activation-timeoutwithserviceRestartSafe: falseand left recovery "to the owning updater". The managed helper is that owner. It loggedrecovery not attempted: updater explicitly rejected activationand left the Gateway down.managed update command lease binding was lost, never reached interrupted recovery, and exited 1, with the run stuck atrunning/activating.Fix
This reuses the helper's existing verified interrupted recovery (
recoverInterruptedUpdater→recoverInterruptedManagedUpdate, the same post-core repair and verification thatupdate repairruns). No new state or store.status: "error",reason: "update-activation-timeout"and nodataAtRisknow enters the same recovery as a killed updater.b9adfb0), only an explicit--timeout/timeoutMsbounds the finalizer worker. An earlier head of this PR restored a default deadline.e978dfa8e13edrops it again: it added a failure path a healthy but slow update could hit (fix(update): let finalization finish without an implicit deadline #153085 removed it for that reason), and ClawSweeper found that its expiry is reported asupdate-recovery-pending, which this recovery does not take.This branch also carries #205675's legacy-path commits (requester policy checked once in the adopted finalizer; RPC-verified interrupted recovery).
Error surfaces (full diff vs
release/2026.11.11)healthRpcVerified(authenticated health RPC plus version/build); before, HTTP readiness was enough. Unverified → run recordedfailed(Recovered runtime could not restore Gateway readiness and identity). From #205675.recoveryTimeoutMs, before that verdict.update-activation-timeoutresult →recoverInterruptedUpdater(), replacing "recovery not attempted".update repairguidance).throw "lease binding was lost"becomes a bounded wait for the worker's child lease, then the same throw if it is still unsettled.recoveryTimeoutMs, and otherwise leads to recovery.checkRequesterOncein the adopted finalizer (#205675) removes a per-mutation requester re-check.No other throw, refusal, exit or rollback trigger is added. Everything else in the diff is docs, test fixtures and the
healthRpcVerifiedprobe field.End-to-end proof on exact head
e978dfa8e13eSetup: private rootless Podman (one task-owned store per cell,
--http-proxy=false), systemd as PID 1, a systemd user unit, synthetic state, and an authenticatedupdate.runRPC against a loopback registry.2026.11.11package built from exactlye978dfa8e13e.2026.11.12(2026.11.12-e978dfa8e13e-next-fixture). Only the version, build ID and dist inventory changed.A cell passes only with authenticated
healthRPCokand agateway status --require-rpcbuild ID equal to the expected package, with no manual repair.e978dfa8e13e)2026.11.12-e978dfa8e13e-next-fixture. Health RPCok. Runsucceeded.update.run05:56:37 → verified 06:00:07 (3m30s)--doctorworker appeared; worker left runningmanaged update command child lease settled after the updater exited, then repair, recovery, andgateway service recovery succeeded (readiness and runtime identity verified). Candidate verified serving, health RPCok, runsucceeded/managed-service-handoff-recovered. No manual repair.--doctorworker and updater SIGKILLed togetherok, runsucceeded/managed-service-handoff-recovered. No manual repair.release/2026.11.11+ #205675 only)handoff failed: managed update command lease binding was lost,terminal writer lost its current claim, helper exited 1. Gatewaydownin every sample until the cell was stopped.Both recovered runs also logged
Update notice changed or belongs to another handoff; it was not replaced/restoration result could not be durably recorded. The run ledger still reachedsucceededand the Gateway was verified. This is a notice-recording warning only.(b) Hung finalizer: not met. On this line the finalizer's only worker process is
update-migrated-finalize.worker.js --doctor. Hanging it hits the Doctor data-at-risk stop described below, notupdate-activation-timeout. The timeout routing in this PR is therefore not reached by a real hang in these cells. It is backed only by the supporting unit test.Not proven end to end (supporting tests only)
update-activation-timeout→ recovery branch (forward and before publication). No real installed hang produced that result on this line (see (b)). Supporting unit test only.checkRequesterOncereducing the stall reported in [Bug]: 2026.11.10 update: update-migrated-finalize.worker spins at ~100% CPU for 80+ min re-loading config for the rollback policy check; Gateway stays down, run ends failed/update-recovery-pending #205547.Supporting unit tests (red on the base, green on this head) are in
src/infra/update-managed-service-handoff-interrupted.test.ts(candidateWorker,finalizerTimeoutfixtures). They are not counted as proof.Open maintainer decision: a hung Doctor phase stays stopped
A service cell on
98eef07638c7(helper and timeout handling identical to this head when an explicittimeoutMsis given) SIGSTOPped the finalizer's Doctor worker (update-migrated-finalize.worker.js --doctor) with an operatortimeoutMs: 420000.update-activation-timeout. It refused withDoctor processes remain unsettled, data-at-risk. PIDs/process groups: …; custody receipt unavailable. Keep the Gateway stopped.recovery not attempted: no verified recovery resultand the Gateway was left stopped.This PR does not change that outcome. It is an existing data-risk refusal:
recoverInterruptedManagedUpdaterefuses a run with a recorded data-at-risk mark, and onlyupdate repairverifies and clears marks. Bringing the Gateway back automatically would mean the helper terminates the unsettled Doctor and runs the mark-verifying repair without a human. That changes data-safety policy, so it needs a maintainer decision. Until then, a hang inside the Doctor phase still needsopenclaw update repair.Without an operator timeout, a hung finalizer stays unbounded, with the Gateway stopped, exactly as on the base.
Accepted edge case
A candidate worker that hangs after its waiting updater was killed has no deadline owner left. The helper waits up to the recovery budget (30 min, or the operator timeout), then falls back to today's
update repairguidance. This needs two faults at once.Refs #205547, #205675. Head:
e978dfa8e13e. Release-line-only fix:maindoes not run this updater for owned installs.