Skip to content

fix(update-repair): preserve repair budgets across wall-clock changes - #190298

Merged
roboclaw-bot merged 2 commits into
mainfrom
roboclaw/update-repair-monotonic-rest
Nov 1, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
roboclaw/update-repair-monotonic-rest

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes repair aborts and inflated timeouts when the host wall clock changes during update repair or embedded triage.

User Impact

Repairs retain the operator-granted elapsed-time budget across forward and backward clock corrections, and reported attempt durations remain nonnegative.

Why This Change Was Made

Completes #190064 (381abce), which fixed the embedded runtime, by using the existing shared monotonic clock for the repair loop, inference selection, and delegated worker. Existing budget defaults, cancellation, authority checks, IPC durations, and absolute timestamps are preserved.

Adapted from SunnyShu0925’s #186818 after reading its full diff and reviews. Contributor credit is included in the commit trailers, together with the requested steipete credit.

Evidence

  • RED: unchanged production owners with new clock-jump regressions: 7 failures, 26 passes across all three owners.
  • GREEN: the same three suites plus the existing runtime suite: 43 tests pass; 45.00 s Vitest wall time (47.32 s including wrapper). The three clock-regression files stay below 5 s of test execution each; cold worker compilation accounts for most wall time. Exact-head CI succeeded; run wall time 1,457 s (24m 17s), including PostgreSQL conformance.
  • Clock steps in both directions preserve remaining route/turn budgets, enforce cancellation at the deadline, and retain accurate elapsed attempt duration. Worker fixtures use isolated state and inert inference.
  • Focused affected test typecheck, six-file lint and formatting, test-line ratchet, and diff whitespace checks pass. Local autoreview: scoped-clean for P0–P2. Local ClawSweeper is unavailable; hosted ClawSweeper also completed with no findings on the repair implementation.
  • Simplification: reuse the shared clock owner; no new helper or state. Production +19/-10, tests +141/-35 (net +106). The separate 106-line allocation covers regressions at the three independently seeded owners.
  • Consumer proof: worker IPC, real repair-turn handoff, inference route/OAuth selection, and CLI triage tests: 49 additional tests pass (47.00 s wrapper wall time).
  • CI repair: the first run exposed two inherited no-unnecessary-type-arguments errors in experience-review.test.ts. Removing <void> from two createDeferred() calls preserves the existing default type. Focused lint reproduces RED and passes GREEN; all 19 existing tests in that file pass (38.36 s wrapper); fresh local autoreview is scoped-clean. The original repair proof remains valid because those sources are unchanged.
  • Production Team host constraint: focused local tests only; no live Gateway, model, or stable-upgrade run. Contributor CLI evidence is historical and is not claimed as fresh validation.

Exact-head CI: run 41305564156, 272b4044cf02d404b0dd8c1751261e3c5583d507, success. Changed-node-test job: 286 s.

Complete the repair clock-domain conversion after #190064 using the existing
process-local monotonic helper in the loop, route selector, and delegated
worker. Measure elapsed attempt durations with the same clock.

Adapt the remaining correction from SunnyShu0925's #186818. Regressions step
the wall clock in both directions while checking budget consumption and
deadline cancellation. Allocate 106 test lines for these independently
seeded budget owners.

Co-authored-by: SunnyShu0925 <[email protected]>
Co-authored-by: steipete <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 1, 2026 12:03
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

Replacement for #186818, completing the three remaining clock owners after #190064. Local autoreview completed with no P0–P2 findings; focused RED/GREEN, consumer tests, lint, formatting, and affected typecheck pass.

@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Use the existing monotonic clock for repair-loop, inference-selection, and delegated-worker budgets and attempt durations.

Example: A 60,000 ms repair budget encounters a 610,000 ms forward clock correction after 1,000 ms of validation.

  • Before: Inference selection receives a 1 ms budget, potentially aborting a repair prematurely.
  • After: Inference selection receives the remaining 59,000 ms elapsed-time budget.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-verified correction with useful boundary regressions, limited by fresh evidence stopping short of the installed product.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor proof gate: fresh reported regressions exercise the three production owners with mocked inference and isolated worker state, while the credited original supplies historical shipped-CLI output rather than current-head product proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A host clock correction can prematurely abort installation repair and make reported attempt durations negative.
Reason: The maintainer-authored change restores the existing elapsed-time budget contract without adding configuration, permissions, storage, or product surface.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes remaining clock-dependent repair budgets on main, with no actionable code or security findings.

Priority: P2
Reviewed head: a414cf0c10a2d8e15d6f1fda2f3b4f9ad969a94c

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Fresh installed-CLI clock-step and published-stable upgrade execution are absent; the linked original CLI trace is historical supporting evidence.
Agent review details

How this fits together

CLI triage and delegated update workers pass installation targets, cancellation, and duration budgets into configured inference and embedded repair execution; caller-owned validation determines the repair result.

flowchart TD
  A[CLI triage] --> B[Repair loop]
  C[Delegated worker] --> D[Inference selection]
  B --> D
  E[Shared monotonic clock] --> B
  E --> C
  E --> D
  D --> F[Embedded repair turn]
  F --> G[Validation and result]
Loading

Technical review

Best possible solution:

Complete the clock-domain correction through the existing repair owners while preserving duration-based IPC, cancellation, and validation ownership.

Do we have a high-confidence way to reproduce the issue?

Current-main arithmetic establishes budget collapse or inflation when Date.now() steps between deadline creation and consumption, supported by reported red regressions and the credited original CLI trace; this review ran no target code.

Is this the best way to solve the issue?

This is the smallest complete correction for the remaining owners: measure elapsed budgets with the shared monotonic clock and retain existing expiry policy without introducing another clock abstraction.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5342923d897a.

Provenance checked

  • Repair-loop deadlines and attempt durations keeps the original intent (d12357e: Provide bounded configured-inference repair with caller-owned validation, cancellation, and cleanup; subsequent specialization retained one-turn execution.)
  • Inference route-probe deadline keeps the original intent (d12357e: Select authenticated configured inference within the repair budget; later inference refactoring explicitly preserved the remaining operation timeout.)
  • Delegated-worker deadline keeps the original intent (df15ee3: Execute one bounded owner-delegated turn while retaining requester, executor, and update-run authority.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d12357e adds src/infra/update-repair-agent.ts:191 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d12357eaa4b6; files: src/infra/update-repair-agent.ts)
  • Dallin Romney: Raw commit df15ee3 adds src/infra/update-repair-turn-worker.ts:31 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: df15ee3a68a0; files: src/infra/update-repair-turn-worker.ts)

PR surface

Source +9, Tests +106, Other +2. Total +117 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 19 10 +9
Tests 3 139 33 +106
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 7 160 43 +117

Review metrics

Metric Value Why it matters
Production versus regression tests Production +19/-10; tests +139/-33 The small production change reuses the shared clock; regression growth covers three independently seeded budget owners and retains existing cancellation coverage.

Root-cause cluster

Relationship: canonical
Canonical: #190298
Summary: This maintainer replacement carries the original contribution's remaining production corrections after the embedded-runtime slice merged separately.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: Clock corrections can prematurely abort optional installation repair or distort downstream timeouts, with a limited trigger and no demonstrated core-runtime outage.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Clock corrections can prematurely abort optional installation repair or distort downstream timeouts, with a limited trigger and no demonstrated core-runtime outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture a redacted installed-CLI repair trace with a clock correction during preparation to strengthen current-head behavior evidence.

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 execution lanes are retired.

Reviewed November 1, 2026, 7:08 AM ET / 12:08 UTC.

Repair the inherited core lint failure exposed by CI for #190298. createDeferred already defaults to void; removing the two explicit type arguments preserves the test contract.
@roboclaw-bot
roboclaw-bot merged commit ed052cc into main Nov 1, 2026
132 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/update-repair-monotonic-rest branch November 1, 2026 12:41
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
…openclaw#190298)

Complete the repair clock-domain correction after openclaw#190064: use the existing
shared monotonic clock for loop, inference-probe, and delegated-worker budgets
and elapsed attempt durations. Preserve budget defaults, cancellation, live
authority checks, IPC durations, and absolute timestamps.

Adapted from SunnyShu0925's openclaw#186818 after reviewing its complete diff and
reviews. Forward/backward clock-jump regressions fail on the original owners
and pass with the fix. Allocate 106 regression lines because the three owners
independently seed and consume their budgets and need distinct boundary proof.
Focused repair and consumer tests pass, and local autoreview found no P0-P2
issues. Live Gateway and stable-upgrade execution were outside the task's
production-host constraint.

Also remove two redundant default void type arguments in an unchanged test
to repair the inherited core-lint failure exposed by this PR's CI. Focused
lint, all 19 tests in that file, and independent review pass.

Co-authored-by: SunnyShu0925 <[email protected]>
Co-authored-by: steipete <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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