Skip to content

fix: show update canary and Doctor phase timings - #168290

Merged
obviyus merged 3 commits into
mainfrom
fix/update-canary-timing
Oct 10, 2026
Merged

obviyus merged 3 commits into
mainfrom
fix/update-canary-timing

Conversation

@obviyus

@obviyus obviyus commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

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 (7008414e344), including a single-worker isolated run. No timeout or assertion was weakened.
  • 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 7008414e344. 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.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@obviyus
obviyus marked this pull request as ready for review October 10, 2026 06:42
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: L labels Oct 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: Successful candidate timings could disappear from the Git update result or compacted history.
  • After: The result records the Doctor duration and section diagnostics alongside copy, startup, cleanup, and activation timings.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful and correct, with native behavior evidence and meaningful negative controls; proof is reported as measured results rather than an attached full execution artifact.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The inspected native-run results exercise the reviewed updater's canary, activation, and Doctor timing owners through real updates, with successful readiness and matching build identity; the published-driver run correctly lacks parent-owned timings on the installing hop.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators cannot distinguish several slow update phases when successful timing receipts are absent or discarded.
Reason: The requested phase observations have concrete diagnostic value without changing activation policy, copy scope, configuration, or public APIs.

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
Reviewed head: 14833345b1e9c06d1dd9dc2c5ac3fa31e6513dbc

Before merge

None.

Findings

None.

Agent review details

How this fits together

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

Technical review

Best 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

  • Candidate validation and activation keeps the original intent (d1a69c0: Validate isolated candidates while serving and retain one activation and recovery owner.)
  • Awaited progress receipts keeps the original intent (f833bb4: Progress must follow committed history, with reporting failures preserving operation and recovery outcomes.)
  • Bounded run-history retention keeps the original intent (8d57d3e: Retain specific lifecycle identities while allowing diagnostic payloads to compact inside existing limits.)
  • Fresh Doctor advisory classification keeps the original intent (47be911: Settled post-plugin execution failures remain warnings after package installation; the new timing row preserves that classification.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 8d57d3e adds src/infra/update-run-codec.ts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8d57d3ec0804; files: src/infra/update-run-codec.ts)
  • Vincent Koc: Raw commit 1232d3f adds src/cli/update-cli/update-command-fresh-doctor.ts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 1232d3f13ec0; files: src/cli/update-cli/update-command-fresh-doctor.ts)

PR surface

Source +378, Tests +484, Docs +11. Total +873 across 28 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 14 631 253 +378
Tests 13 520 36 +484
Docs 1 11 0 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 28 1162 289 +873

Review metrics

Metric Value Why it matters
Production versus test LOC Production +631/-253; tests and test support +520/-36. Production growth supplies timing collection and bounded retention; extracted completion and settlement logic replaces its original locations, and tests cover receipt propagation, failures, compaction, and existing rows.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Missing update timing attribution causes operator confusion but does not itself prevent updates or corrupt state.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-10T06:50:02.763Z sha 27d967d :: blocked before merge. :: [P2] [P2] Bound Doctor payloads before retaining their timing rows

Reviewed October 10, 2026, 6:52 AM ET / 10:52 UTC (Revision 2).

@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

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.

@obviyus
obviyus merged commit 77224e7 into main Oct 10, 2026
157 of 165 checks passed
@obviyus
obviyus deleted the fix/update-canary-timing branch October 10, 2026 11:01
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

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.

obviyus added a commit that referenced this pull request Oct 10, 2026
## 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
## 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…#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]>
RomneyDa pushed a commit that referenced this pull request Oct 13, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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