Repository navigation
fix: show update canary and Doctor phase timings - #168290
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 changesThe PR records update phase durations and Doctor section timings and preserves their identities in bounded run history. Example: A native Git update spends 61.175 seconds running the rehearsal Doctor.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it adds useful update diagnostics, resolves the prior compaction finding, and has no remaining actionable defect identified. Exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe update CLI coordinates candidate validation, activation, Doctor, and recovery; phase results and child trace output become bounded diagnostics in update output and SQLite-backed run history. flowchart TD
A[Update CLI] --> B[Candidate rehearsal]
A --> C[Runtime activation]
B --> D[Doctor child traces]
C --> D
D --> E[Timing diagnostics]
B --> F[Run history owner]
C --> F
E --> F
F --> G[Update output and history]
Technical reviewBest possible solution: Land the focused timing change through the normal checks while retaining its explicit accounting and installed-driver limitations. Do we have a high-confidence way to reproduce the issue? The introduced diff verifies discarded successful Git candidate results and absent cleanup and activation receipts; the supplied negative control reports intended failures on the merge base, although this read-only review ran no tests. Is this the best way to solve the issue? The change uses the existing progress, trace, and history owners without changing update decisions or persisted schemas; incomplete total-duration accounting is disclosed and does not invalidate the named timings. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eae2e5421daa. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +378, Tests +484, Docs +11. Total +873 across 28 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 10, 2026, 6:52 AM ET / 10:52 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Maintainer override: the only failing CI leaf is check-test-types-core-4 (https://github.com/openclaw/openclaw/actions/runs/38046167188/job/114196323006); openclaw/ci-gate reflects that leaf. It reports TS2345 at src/gateway/control-ui-public-session-refresh.test.ts:51:19 (string | undefined passed as string). The same command graph reproduces the identical failure on clean current main 123d5a1, after frozen-lockfile dependency installation: node scripts/run-tsgo.mjs --noEmit -p test/tsconfig/tsconfig.core.test.gateway-root.json (exit 2). The faulty indexed capture is introduced by main commit 06c6e83, unrelated to this PR. Latest main CI 38046366888 skips this type graph, so its green status does not cover the failing check. No timeout or assertion changed. Landing authorized with this proven unrelated failure; exact-head ClawSweeper review is ready for 1483334. |
|
Landed as 77224e7. Git update results now preserve canary/cleanup timing and Doctor section diagnostics. Focused regressions, negative controls, published-driver compatibility and the single instrumented native update support the change. Full wall-time accounting remains explicitly incomplete; the follow-up will retain the existing updater-runtime-retention timer. The unrelated public-session test-type failure was reproduced on current main and documented in the maintainer override. Thanks for the timing report. |
## What Problem This Solves Update reports omit the running updater's retained-runtime preparation and report no measured duration for native service reconciliation or the fresh-driver handoff. A long quiet interval can therefore look like candidate-state copying even when the old Gateway is still serving. ## User Impact Operators can see `updater-runtime-retention` in the JSON result and bounded run history, including the existing inventory/materialization counts and durations. The native executor probe and successful install/restart child have separate timers. Fresh-driver finalization reports the interval from the previous driver's last completed receipt to resuming finalization. The change reports time; it does not make updates faster or alter admission, stop, restart, recovery, or verification decisions. ## Why This Change Was Made Follow-up to #168290. In its single instrumented run, result steps totaled 811.368s against 1,875.067s overall. The largest residual is before the candidate snapshot: a 1,136.917s interval contains 289.982s of explicit Git/install/build steps, leaving 846.935s unallocated. The existing `updater-runtime-retention` progress timer never reached the returned result and could be evicted from history. Preserve that timer rather than introducing a new tracing format. Read-only inspection found 145,186 regular files in that run's retained runtime. Retention inventories and hashes regular files before materialization, even when it can hardlink their bytes. This is a plausible large-cost owner, **not proof that retention alone consumed the 846.935s residual**. No new update run or optimization was performed. The old Gateway remained ready throughout this interval. ## Compatibility and Evidence - Rebased the service/handoff change onto main after #168290 landed. - Reuses `UpdateStepResult` and existing ledger timestamps. No schema, persisted record shape, timeout, or update policy change; the retention list changes eviction priority inside the existing byte/count limits. - The installed updater owns retention and service timing, so those observations require the updated driver on a subsequent update. The fresh worker owns handoff timing and can report it on the installing hop using existing parent receipts. - Focused proof covers service probe/child separation, preserved failure behavior, result-to-ledger propagation, fresh-driver receipt timing, retention result publication, bounded-history eviction and existing-row compatibility. - No new live update was run. The published 2026.9.8-to-candidate and instrumented same-tree evidence in #168290 remains the live behavior boundary; these additional timers are covered by the focused regressions. - Focused checks passed: 81 tests covering the service command, service lifecycle, fresh-driver worker, ledger compaction, CLI retention result, revoked-owner restart paths, and update/Doctor failure receipts. Focused source lint and formatting passed. - Negative control on clean main `123d5a1331a`: the new retention-result assertion fails because the timer is missing from result steps, and all three bounded-history cases fail because retention timing is evicted. No timeout or assertion was weakened. - Failure-receipt tests preserve their strict step ordering with the new retention prefix. The worker ledger mock explicitly isolates real state, and its obsolete mock-baseline exception was removed. - No overlap with Pash/Sarah changes. Merge danger: two-way door. A revert removes additional diagnostic observations. Existing run rows remain readable. Blast radius is update-result diagnostics and their bounded history; service commands and update behavior are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves Fixes unexplained gaps in `openclaw update` reports when candidate rehearsal, post-stop checks, or runtime activation takes a long time. ## User Impact Operators can distinguish private-state copying, Doctor work, test Gateway startup, cleanup, and activation work instead of treating the entire quiet interval as a slow copy. Doctor diagnostics include section durations and the five slowest contributions. The installed updater remains the driver: most new timings first appear on the update after installing this change. Pre/post-plugin Doctor timings can appear on the installing hop. Older Doctor candidates without section traces still work without section diagnostics. ## Why This Change Was Made Git updates discarded successful candidate step results, successful temporary-copy cleanup had no step, and bounded run-history compaction could evict the timing receipts. Keep those receipts, expose the previously untimed activation phases, and reuse Doctor's existing startup-trace phases without introducing a tracing option or changing the run-record shape. Copy-scope investigation: the canary already snapshots registered SQLite databases and copies exec approvals/configured plugin trees, not `worktrees/`, `workspace/`, or `tmp/`. Synthetic file counts do not change that copy. Peanutto's approximately 40-minute silent stretch is therefore not explained by copying those directories; these timings will identify the slow phase on the next real update. No copy-scope reduction is implemented. ## Evidence - Retained synthetic-state experiment: adding 0, 25,000, 100,000, and 250,000 unrelated state files left the copied database byte count fixed at 1,757,184. Snapshot-only runs copied three files (1,692 KiB) in 1.2–3.0 seconds. Full-canary reruns varied with host contention rather than unrelated file count; Doctor and Gateway startup dominated. - Core typecheck and focused lint passed. After the history/receipt repairs, 174 focused tests passed; the final six-case fresh-Doctor timing table also passed, including nonzero and timeout advisories. Earlier focused canary, activation, and finalization coverage remains applicable. - The existing `persists streamed candidate progress through its admitted worker (reopened)` test hit its unchanged 120-second timeout both here and on the exact clean merge base (`6d29c825824`), including a single-worker isolated run. No timeout or assertion was weakened. - No overlap with Pash/Sarah changes. - Backward compatibility: a literal pre-timing row fixture, validated against the published 2026.9.8 and main schemas, still loads, lists, and compacts with unchanged identity/timestamps/core facts. A 32-key × approximately 1 KiB Doctor refusal now compacts while preserving timing and bounded refusal context. - Native published-driver compatibility: installed 2026.9.8 (`fc23bc864e4`) updated successfully to `14833345b1e9`; source HEAD and built commit match, the Gateway returned readiness HTTP 200, and the run finished `succeeded`. The candidate-side post-plugin Doctor recorded 87.078 s with section diagnostics (78.2 s across sections). Canary/activation timing remains absent on this installing hop because the published driver owns those phases. Single-run native attribution (`14833345b1e9` → identical tree plus an empty commit `6c40e71a42bd`; not a speed comparison) also finished successfully with matching source/build commits and readiness HTTP 200: | Recorded step | Duration | | --- | ---: | | Canary state copy | 25.441 s | | Canary Doctor | 61.175 s | | Canary Gateway startup | 23.088 s | | Canary cleanup | 2.097 s | | Other canary checks | 40.567 s | | Post-stop checks (two passes) | 4.901 s + 4.299 s | | Git checkout | 1.932 s | | Runtime activation | 0.113 s | | Activation Doctor | 23.454 s | | Post-plugin Doctor | 22.987 s | Doctor section sums were 46.5/61.175 s for the canary, 21.3/23.454 s for activation, and 21.9/22.987 s post-plugin; process/bootstrap overhead is outside those section spans. The full canary steps sum to 152.368 s. **Accounting limit:** all reported step durations total 811.368 s, versus 1,875.067 s for the overall run; the validating phase alone is 1,632.268 s. These receipts expose the requested phases, but do not yet account for the full phase totals. No claim of complete wall-time attribution is made. The candidate Gateway also successfully listed the published driver's existing run through `update.runs.list`, preserving its successful outcome and history. - Negative control: the new timing assertions were transplanted onto production code at merge base `6d29c825824`. All 17 selected cases failed for absent timing/trace/retention behavior, not test setup; they pass with the change. Commands used `node scripts/run-vitest.mjs <file> -t <selector>`: | Suite | Selector | Expected pre-fix failures | | --- | --- | ---: | | `update-command-execution-validation.test.ts` | `reports Git candidate\|reports the post-stop` | 2 | | `update-command-fresh-doctor.test.ts` | `records the fresh Doctor` | 6 | | `update-command-package-doctor.test.ts` | `records the activation Doctor` | 1 | | `update-finalization-lifecycle.test.ts` | `preserves .* duration and section` | 2 | | `update-candidate-canary.test.ts` | `rehearses private state\|records the rehearsal Doctor` | 2 | | `update-runner-git-candidate.test.ts` | `reports candidate checks` | 1 | | `update-run-ledger.compaction.test.ts` | entire suite before the compatibility case was added | 3 | Paired synthetic copy study (two alternating runs per state; median and min–max, not a speedup claim): | Unrelated files | Copied SQLite bytes | Copy median (range) | Whole-canary median (range) | | --- | ---: | ---: | ---: | | 0 | 1,757,184 | 6.36 s (1.72–11.01) | 101.81 s (58.69–144.92) | | 250,000 | 1,757,184 | 3.08 s (2.45–3.71) | 90.35 s (80.26–100.44) | The large overlapping spread reflects host contention; unrelated file count does not expand the copied state. This is attribution work, not an update-speed improvement. The untouched `model-catalog-decisions.ts` line-count warning has the same file blob on the merge base and this branch (`7c1b6e01f07a155aac10409b18c5822277b96ede`). The changed update modules were split at their Doctor-completion and result-settlement seams and pass focused lint. Merge danger: two-way door. This changes timing/reporting only, not update decisions, configuration, schemas, or persisted record shape. Run-history changes only eviction priority within the existing bounds. A revert removes the additional observations. The blast radius is update diagnostics and their bounded history. Co-authored-by: Ayaan Zaidi <[email protected]>
…#168409) ## What Problem This Solves Update reports omit the running updater's retained-runtime preparation and report no measured duration for native service reconciliation or the fresh-driver handoff. A long quiet interval can therefore look like candidate-state copying even when the old Gateway is still serving. ## User Impact Operators can see `updater-runtime-retention` in the JSON result and bounded run history, including the existing inventory/materialization counts and durations. The native executor probe and successful install/restart child have separate timers. Fresh-driver finalization reports the interval from the previous driver's last completed receipt to resuming finalization. The change reports time; it does not make updates faster or alter admission, stop, restart, recovery, or verification decisions. ## Why This Change Was Made Follow-up to openclaw#168290. In its single instrumented run, result steps totaled 811.368s against 1,875.067s overall. The largest residual is before the candidate snapshot: a 1,136.917s interval contains 289.982s of explicit Git/install/build steps, leaving 846.935s unallocated. The existing `updater-runtime-retention` progress timer never reached the returned result and could be evicted from history. Preserve that timer rather than introducing a new tracing format. Read-only inspection found 145,186 regular files in that run's retained runtime. Retention inventories and hashes regular files before materialization, even when it can hardlink their bytes. This is a plausible large-cost owner, **not proof that retention alone consumed the 846.935s residual**. No new update run or optimization was performed. The old Gateway remained ready throughout this interval. ## Compatibility and Evidence - Rebased the service/handoff change onto main after openclaw#168290 landed. - Reuses `UpdateStepResult` and existing ledger timestamps. No schema, persisted record shape, timeout, or update policy change; the retention list changes eviction priority inside the existing byte/count limits. - The installed updater owns retention and service timing, so those observations require the updated driver on a subsequent update. The fresh worker owns handoff timing and can report it on the installing hop using existing parent receipts. - Focused proof covers service probe/child separation, preserved failure behavior, result-to-ledger propagation, fresh-driver receipt timing, retention result publication, bounded-history eviction and existing-row compatibility. - No new live update was run. The published 2026.9.8-to-candidate and instrumented same-tree evidence in openclaw#168290 remains the live behavior boundary; these additional timers are covered by the focused regressions. - Focused checks passed: 81 tests covering the service command, service lifecycle, fresh-driver worker, ledger compaction, CLI retention result, revoked-owner restart paths, and update/Doctor failure receipts. Focused source lint and formatting passed. - Negative control on clean main `78d107dc690`: the new retention-result assertion fails because the timer is missing from result steps, and all three bounded-history cases fail because retention timing is evicted. No timeout or assertion was weakened. - Failure-receipt tests preserve their strict step ordering with the new retention prefix. The worker ledger mock explicitly isolates real state, and its obsolete mock-baseline exception was removed. - No overlap with Pash/Sarah changes. Merge danger: two-way door. A revert removes additional diagnostic observations. Existing run rows remain readable. Blast radius is update-result diagnostics and their bounded history; service commands and update behavior are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
…168210) (2026.10.5 backport) Recovery-critical update history writes wait for a contended writer; bookkeeping steps use a 1 s budget and warn and continue when the database is locked; Gateway writes keep 5 s. Refs #168072. Backport notes: took the driver busy-wait budget, the bookkeeping-skip path, required-step classification, worker lock handling and their regression tests. Left out the Doctor-child revokeSqliteDatabaseAdmissionsForPath() call: main's cached schema-admission module (sqlite-database-admission.ts, #167739 and later) does not exist on 2026.10.5, so there is no cached admission to invalidate after Doctor migrates in a child process. The added update-command-doctor-child regression still verifies that the parent sees the child's newer schema on this branch. The contention test drops its isRetainedStep() precondition: the expanded retained-step list (#168290, #168409) is a separate diagnostics feature not on 2026.10.5; the bookkeeping-skip behavior under test is unchanged. Extracted-from: b2e11a2
What Problem This Solves
Fixes unexplained gaps in
openclaw updatereports when candidate rehearsal, post-stop checks, or runtime activation takes a long time.User Impact
Operators can distinguish private-state copying, Doctor work, test Gateway startup, cleanup, and activation work instead of treating the entire quiet interval as a slow copy. Doctor diagnostics include section durations and the five slowest contributions.
The installed updater remains the driver: most new timings first appear on the update after installing this change. Pre/post-plugin Doctor timings can appear on the installing hop. Older Doctor candidates without section traces still work without section diagnostics.
Why This Change Was Made
Git updates discarded successful candidate step results, successful temporary-copy cleanup had no step, and bounded run-history compaction could evict the timing receipts. Keep those receipts, expose the previously untimed activation phases, and reuse Doctor's existing startup-trace phases without introducing a tracing option or changing the run-record shape.
Copy-scope investigation: the canary already snapshots registered SQLite databases and copies exec approvals/configured plugin trees, not
worktrees/,workspace/, ortmp/. Synthetic file counts do not change that copy. Peanutto's approximately 40-minute silent stretch is therefore not explained by copying those directories; these timings will identify the slow phase on the next real update. No copy-scope reduction is implemented.Evidence
persists streamed candidate progress through its admitted worker (reopened)test hit its unchanged 120-second timeout both here and on the exact clean merge base (7008414e344), including a single-worker isolated run. No timeout or assertion was weakened.fc23bc864e4) updated successfully to14833345b1e9; source HEAD and built commit match, the Gateway returned readiness HTTP 200, and the run finishedsucceeded. The candidate-side post-plugin Doctor recorded 87.078 s with section diagnostics (78.2 s across sections). Canary/activation timing remains absent on this installing hop because the published driver owns those phases.Single-run native attribution (
14833345b1e9→ identical tree plus an empty commit6c40e71a42bd; not a speed comparison) also finished successfully with matching source/build commits and readiness HTTP 200:Doctor section sums were 46.5/61.175 s for the canary, 21.3/23.454 s for activation, and 21.9/22.987 s post-plugin; process/bootstrap overhead is outside those section spans. The full canary steps sum to 152.368 s. Accounting limit: all reported step durations total 811.368 s, versus 1,875.067 s for the overall run; the validating phase alone is 1,632.268 s. These receipts expose the requested phases, but do not yet account for the full phase totals. No claim of complete wall-time attribution is made.
The candidate Gateway also successfully listed the published driver's existing run through
update.runs.list, preserving its successful outcome and history.Negative control: the new timing assertions were transplanted onto production code at merge base
7008414e344. All 17 selected cases failed for absent timing/trace/retention behavior, not test setup; they pass with the change. Commands usednode scripts/run-vitest.mjs <file> -t <selector>:update-command-execution-validation.test.tsreports Git candidate|reports the post-stopupdate-command-fresh-doctor.test.tsrecords the fresh Doctorupdate-command-package-doctor.test.tsrecords the activation Doctorupdate-finalization-lifecycle.test.tspreserves .* duration and sectionupdate-candidate-canary.test.tsrehearses private state|records the rehearsal Doctorupdate-runner-git-candidate.test.tsreports candidate checksupdate-run-ledger.compaction.test.tsPaired synthetic copy study (two alternating runs per state; median and min–max, not a speedup claim):
The large overlapping spread reflects host contention; unrelated file count does not expand the copied state. This is attribution work, not an update-speed improvement.
The untouched
model-catalog-decisions.tsline-count warning has the same file blob on the merge base and this branch (7c1b6e01f07a155aac10409b18c5822277b96ede). The changed update modules were split at their Doctor-completion and result-settlement seams and pass focused lint.Merge danger: two-way door. This changes timing/reporting only, not update decisions, configuration, schemas, or persisted record shape. Run-history changes only eviction priority within the existing bounds. A revert removes the additional observations. The blast radius is update diagnostics and their bounded history.