Repository navigation
fix(daemon): keep service update authority deadline on the monotonic clock - #183104
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 changesThis PR makes queued native-service command deadlines use the existing monotonic clock instead of wall time. Example: A command has a 20 ms admission budget; after 5 ms, the system clock jumps forward 60 seconds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: current main retains the wall-clock deadline bug, and this focused fix preserves queue ordering, scoped accounting, and live authority checks. No actionable defects found; exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherUpdate and maintenance operations submit native commands through a scoped FIFO queue that checks current authority and passes the remaining timeout to the child-process runner. flowchart LR
A[Update or maintenance] --> B[Scoped native command queue]
C[Inspection or monotonic clock] --> B
B --> D[Live authority checks]
D --> E[Native child process]
E --> F[Result and cleanup settlement]
Technical reviewBest possible solution: Use the existing clock default and retain the focused regression, FIFO queue, and live authority checks. Do we have a high-confidence way to reproduce the issue? The current-main clock selection and remaining-time arithmetic establish the failure path; supplied red-to-green and real-process comparisons corroborate it, without executing target code during this review. Is this the best way to solve the issue? This is the smallest complete fix: remove the wall-clock override at the existing queue owner, preserve scoped clocks, and add one distinct behavioral regression. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 189ed6f72718. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +22, Docs +3. Total +25 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 (2 earlier review cycles)
Reviewed October 25, 2026, 4:40 PM ET / 20:40 UTC (Revision 3). |
…clock The native command admission deadline in service-update-authority.ts used Date.now() (wall clock) as the fallback for getServiceInspectionClock. Wall clock jumps from NTP corrections or manual changes cause queued commands to expire prematurely or hang indefinitely. Switch to performance.now() (monotonic), aligning with every other daemon caller and the getServiceInspectionClock default.
8fd3db9 to
dbc554c
Compare
|
Hi @clawsweeper, CI is green after rebasing onto main (check-prod-types and check-test-types-core-2 now pass), and I added real behavior proof exercising the shipped authority path with real systemd user native operations (queued native command across a clock step, normal elapsed-time expiry, and a before/after table). Requesting re-review. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Use the existing inspection clock default so wall-clock corrections cannot expire or extend queued native-service commands. Preserve scoped accounting, FIFO admission, and live authority checks. Tighten the clock-step regression, document the elapsed-time contract, and integrate current main. Real child-process proof reproduces premature expiry with the old clock and successful admission with the fix. Co-authored-by: 0668000539 <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…clock (openclaw#183104) The native command admission deadline in service-update-authority.ts used Date.now() (wall clock) as the fallback for getServiceInspectionClock. Wall clock jumps from NTP corrections or manual changes cause queued commands to expire prematurely or hang indefinitely. Switch to performance.now() (monotonic), aligning with every other daemon caller and the getServiceInspectionClock default. Co-authored-by: 0668000539 <[email protected]>
…clock (#183104) The native command admission deadline in service-update-authority.ts used Date.now() (wall clock) as the fallback for getServiceInspectionClock. Wall clock jumps from NTP corrections or manual changes cause queued commands to expire prematurely or hang indefinitely. Switch to performance.now() (monotonic), aligning with every other daemon caller and the getServiceInspectionClock default. Co-authored-by: 0668000539 <[email protected]> (cherry picked from commit 8023658) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit d92c21558155d5828df7de82ff5a72f4025f4b2c)
What Problem This Solves
Queued native service commands can time out early or wait beyond their intended budget when the system wall clock changes during an update or maintenance operation.
User Impact
Native command admission keeps its elapsed-time budget across system-clock corrections. Existing timeout values, queue ordering, and live authority checks remain in place.
Why This Change Was Made
Use the existing inspection clock's monotonic default instead of overriding it with
Date.now(). This also preserves the clock supplied by an active inspection-budget scope. The regression advances elapsed time before stepping the wall clock, so it exercises an actual queued command with budget remaining.Thanks to @SunnyShu0925 for the original fix and regression. The contributor's commit is preserved.
Evidence
Native command admission timed out; with the fix, all 28 tests pass acrossservice-update-authority-runner,service-update-authority,service-inspection-budget, andsystemd-peer-queue./usr/bin/truebehind/bin/sleep 0.1. After a simulated +60-secondDate.now()step, the old implementation rejects admission withETIMEDOUT; the fixed implementation runs the child successfully with exit code 0.