Skip to content

fix(update): keep persisted and printed completion durations consistent - #133809

Merged
steipete merged 1 commit into
mainfrom
codex/update-reporting-duration
Aug 31, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/update-reporting-duration

Conversation

@steipete

@steipete steipete commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where openclaw update could 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

  • Hosted reproduction: CI run 33357602761, attempt 1, job checks-node-compact-small-2, failed only on persisted duration 0 versus printed duration 1. The failed-only rerun passed, but did not repair the race.
  • Deterministic before/after: advance the clock during sentinel persistence in existing success and service-inspection/revalidation cases. Before repair: 3 failed, 31 passed. After repair: all 34 owner tests passed. No sleeps, tolerance changes, retry wrapper, or weaker equality assertion.
  • 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.
  • Live operator services were not interrupted to force a failed update. The clock boundary is fault-injected in the owner tests; service integration tests provide the neighboring activation proof. This is not a claim of a live managed-service update.
  • Final fixture consolidation: all 34 owner cases pass again; two-file formatting, lint, and git diff --check pass. 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.
  • Local changed gate passed the conflict/line-count/assertion/deprecation/ownership/dependency/dead-export checks before encountering the shared install's pre-existing tslog type mismatch in src/logging/logger.ts (attachTransport/settings). No updater type error was reported. Shared dependencies were not reconciled; clean hosted CI is required before landing.
  • Managed Codex autoreview: scoped-clean through P2, no actionable findings. Final source integrity checks passed.
  • Direct persistence/output proof on 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.
  • Final hosted CI: run 33359875587 passed on exact a0fe0d5a72c5e7d16247f4c15a037a16005b8f44, including the required openclaw/ci-gate at 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.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 31, 2026
@steipete
steipete marked this pull request as ready for review August 31, 2026 05:15
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 1:22 AM ET / 05:22 UTC.

ClawSweeper review

What this changes

The PR captures one elapsed-time snapshot for ordinary update-result persistence and CLI output, while retaining a later CLI-only measurement after recovery.

Regression provenance

Possible 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
Reviewed head: a0fe0d5a72c5e7d16247f4c15a037a16005b8f44

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, coherent owner-boundary repair with deterministic regression coverage and no actionable review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor real-behavior gate; its supplied body nevertheless describes an isolated real finalization and SQLite-sentinel check, while the reviewed source and deterministic owner tests cover the changed boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor real-behavior gate; its supplied body nevertheless describes an isolated real finalization and SQLite-sentinel check, while the reviewed source and deterministic owner tests cover the changed boundary.
Evidence reviewed 6 items Introduced finalization boundary: The PR adds one completed-result projection; ordinary reporting persists that object and prints the same object, eliminating the prior two independent clock reads.
Persistence contract: The sentinel payload carries the supplied result duration unchanged into its persisted statistics, so sharing the result snapshot is the owner-boundary fix.
Focused regression coverage: Owner tests advance the clock during sentinel persistence and assert ordinary persistence equals printed output, while recovery retains the intentional pre-restart versus post-recovery timing distinction.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests -7. Total -5 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 18 16 +2
Tests 1 57 64 -7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 75 80 -5

Review metrics

Metric Value Why it matters
Production versus test delta production +2 net (18 added, 16 removed); tests -7 net (57 added, 64 removed) The small production increase centralizes duplicate duration measurement, while the tests consolidate setup and add deterministic timing assertions.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This repairs a bounded but real inconsistency in update completion reporting and control-plane state.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor real-behavior gate; its supplied body nevertheless describes an isolated real finalization and SQLite-sentinel check, while the reviewed source and deterministic owner tests cover the changed boundary.

Label justifications:

  • P2: This repairs a bounded but real inconsistency in update completion reporting and control-plane state.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor real-behavior gate; its supplied body nevertheless describes an isolated real finalization and SQLite-sentinel check, while the reviewed source and deterministic owner tests cover the changed boundary.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit f7f38bc into main Aug 31, 2026
248 checks passed
@steipete
steipete deleted the codex/update-reporting-duration branch August 31, 2026 05:33
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant