Repository navigation
fix(update): keep persisted and printed completion durations consistent - #133809
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 1:22 AM ET / 05:22 UTC. ClawSweeper reviewWhat this changesThe PR captures one elapsed-time snapshot for ordinary update-result persistence and CLI output, while retaining a later CLI-only measurement after recovery. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open: this is a focused, source-supported repair for a current-main updater reporting race. No introduced correctness or security defect was found; the member-authored, maintainer-labeled PR should proceed through normal maintainer review and exact-head CI. Priority: P2 Review scores
Verification
How this fits togetherThe update CLI runs package and service work, persists a control-plane restart outcome for Gateway consumption, then renders the final terminal or JSON result. This change governs the elapsed-time value crossing from finalization into those two outputs. flowchart LR
A[Update command] --> B[Update finalization]
B --> C[Completed result snapshot]
C --> D[Restart sentinel]
C --> E[CLI or JSON result]
D --> F[Gateway recovery]
F --> E
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests -7. Total -5 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the single-snapshot finalization repair after normal exact-head CI, preserving the explicit recovery rule that never rewrites an already consumable restart sentinel. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible: the pre-fix reporting path measured elapsed time before the awaited sentinel write and again when printing, so advancing the clock during that write yields divergent values; the PR tests encode that case deterministically. Is this the best way to solve the issue? Yes. Capturing the ordinary result once at the finalization owner is narrower and safer than tolerating differing durations downstream; recovery remains deliberately distinct because its CLI duration includes recovery work after the one-time persisted notification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e1a15aacedd1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Fixes an issue where
openclaw updatecould report a different elapsed duration in CLI output and the persisted control-plane result when writing the result crossed a clock tick. This also caused intermittent release-verification CI failures.Related: #133622 (update finalization reporting), #133616 (release-verification work that exposed the race).
Why This Change Was Made
Finalization now creates one completed result snapshot and reuses it for ordinary persistence and printing. The printer no longer silently measures time again. Failed-update recovery retains its separate lifecycle boundary: write the notification once before restarting the Gateway, then include recovery time in the CLI result without rewriting or mutating the earlier notification. The restart-health and wrapper-retirement failure paths still measure elapsed time when they finish.
No service ownership, restart policy, storage schema, configuration, or public result shape changes. Production delta is +2 lines: the shared duration projection replaces duplicate measurement and makes the two completion boundaries explicit. Existing tests are strengthened, with repeated fixtures consolidated and clock spies restored in shared teardown; no new production test seam or dropped case.
User Impact
Ordinary update reports agree across CLI and control-plane output. Recovery still notifies the Gateway before it starts and includes recovery time in the final CLI duration. Existing documentation already describes the retained total-time behavior.
Evidence
checks-node-compact-small-2, failed only on persisted duration0versus printed duration1. The failed-only rerun passed, but did not repair the race.node scripts/run-vitest.mjs src/cli/update-cli/update-command-post-update.test.ts src/cli/update-cli/progress.test.ts src/cli/update-cli/update-command-service.test.ts src/cli/update-cli/update-command-service.integration.test.ts: 123 passed across 4 files, including actual version guards and preserved native service artifacts. Recovery error/skipped cases explicitly prove one pre-recovery notification, no mutation of its duration, and post-recovery CLI timing.git diff --checkpass. Final delta: production +2, tests −7. Shared spy teardown replaces per-case clock cleanup, and repeated successful-switch fixture arguments are evaluated through the same helper at call time.tslogtype mismatch insrc/logging/logger.ts(attachTransport/settings). No updater type error was reported. Shared dependencies were not reconciled; clean hosted CI is required before landing.a0fe0d5a72c5e7d16247f4c15a037a16005b8f44: an isolated process ran the real finalization function for a synthetic non-restartable failure, wrote through the actual SQLite sentinel owner, and printed actual JSON. A second process read the sentinel: both durations were exactly 250 ms and both status/reason fields agreed. Writer exit 1 was the expected synthetic failure, reader exit 0, parent verification exit 0. Fresh HOME/state/config, no real Gateway touched, no mocked printer or writer.a0fe0d5a72c5e7d16247f4c15a037a16005b8f44, including the requiredopenclaw/ci-gateat 05:31:43 UTC. The latest exact-head ClawSweeper review has no code findings, no before-merge requests, and no rank-up moves. Normal squash landing, without a gate bypass.