Repository navigation
fix(agents): keep provider local service readiness and stop budgets on the monotonic clock - #182778
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 uses monotonic time for local-provider readiness and process-stop deadlines while adapting clock-dependent tests. Example: The wall clock moves backward five seconds during a 1.5-second readiness budget.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main deadline bug, resolves the prior findings, and has no remaining actionable review findings; exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherProvider requests acquire leases from the shared local-service owner, which starts configured processes, probes HTTP readiness, and joins process-tree cleanup. flowchart TD
A[Provider request] --> B[Local service acquisition]
B --> C[Configured child process]
B --> D[HTTP readiness probes]
D --> E[Lease or timeout]
E --> F[Process tree cleanup]
Technical reviewBest possible solution: Keep the focused monotonic deadline replacement and its adapted lifecycle fixtures, then land after the existing exact-head gates pass. Do we have a high-confidence way to reproduce the issue? Current-main deadline arithmetic establishes the failure mechanism, corroborated by supplied Gateway before/after runs; this read-only review executed no target code. Is this the best way to solve the issue? Changing deadline seeds and comparisons in the existing owners is the smallest complete fix, preserving configured budgets, cleanup ordering, and diagnostic timestamps. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 95a3ccde1410. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +7, Tests +60. Total +67 across 6 files. Added test files: 1. View PR surface stats
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 (2 earlier review cycles)
Reviewed October 26, 2026, 1:35 AM ET / 05:35 UTC (Revision 3). |
…n the monotonic clock
cee1a10 to
c6b5526
Compare
|
Fixed the checks-node-changed-3 failure: the settlement/shutdown suites drive the service lifecycle with fake timers + faked Date but did not fake |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 815a9bd. Thanks @mikasa0818. Local provider deadlines now ignore wall-clock jumps. |
…n the monotonic clock (openclaw#182778) fix(agents): use monotonic time for local provider readiness and stop deadlines Configured local providers measured their readiness and process-stop deadlines with the wall clock, so a backward clock correction stretched those waits well past their budgets. The deadlines now use monotonic time. Evidence: built Gateway and CLI with a configured local provider, with the wall clock shifted back inside the process under test only (the system clock was not touched). Readiness took 6.75-6.78s on main and 1.69-1.70s with this change; the SIGTERM-to-SIGKILL stop took 7.00-7.05s on main and 2.05-2.06s with this change. Runs without a clock step or with a forward step behave the same on both refs, and real local inference still works. The regression fixture now holds its port reservation through child launch and shutdown. Production about 17 lines. Thanks @mikasa0818. Co-authored-by: Ayaan Zaidi <[email protected]>
…n the monotonic clock (#182778) fix(agents): use monotonic time for local provider readiness and stop deadlines Configured local providers measured their readiness and process-stop deadlines with the wall clock, so a backward clock correction stretched those waits well past their budgets. The deadlines now use monotonic time. Evidence: built Gateway and CLI with a configured local provider, with the wall clock shifted back inside the process under test only (the system clock was not touched). Readiness took 6.75-6.78s on main and 1.69-1.70s with this change; the SIGTERM-to-SIGKILL stop took 7.00-7.05s on main and 2.05-2.06s with this change. Runs without a clock step or with a forward step behave the same on both refs, and real local inference still works. The regression fixture now holds its port reservation through child launch and shutdown. Production about 17 lines. Thanks @mikasa0818. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 815a9bd) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 72995431b55a2cd70f8e5065ece51cf27b9076d5)
What Problem This Solves
Local provider readiness and process-stop deadlines used wall-clock time. A backward clock correction extended configured timeouts; a forward correction prematurely expired them. Use monotonic elapsed time for these deadlines without changing their configured budgets or settlement behavior.
The regression test now uses the existing local-service fixture's
claimPort(), retaining the reservation until managed-child shutdown finishes instead of releasing agetFreePort()reservation before startup.Evidence
Built the shipped Gateway and CLI on main (
bdf12f6b6b1235f10ee361687e0c32db94dd3a6b) and this candidate. A configured local provider served real HTTP readiness responses and Responses inference. Only the Gateway process'sDate.now()was stepped; system time, timers, and monotonic clocks were unchanged. Every recorded case required an owned child spawn, an HTTP probe, and child close.LOCAL_CLOCK_OKresponse before idle shutdown. These Linux signal/close observations do not claim native Windows taskkill coverage.The focused local-service, monotonic, settlement, and shutdown suites pass: 30 tests across four files. The existing failed one-shot-host subprocess fixture now accelerates
performance.now()rather thanDate.now(), preserving real child cleanup without a 60-second readiness wait. Its previous clock-domain mismatch reproduced on the first candidate and passed on main; adapting the fixture resolves it. Formatting and lint checks pass for all six changed files.Compatibility and Merge Danger
No configuration, persisted state, or public API changes. This is a two-way door: reverting restores wall-clock deadline behavior. The blast radius is configured local-provider readiness and managed-process shutdown; inference transports and unrelated provider selection are unchanged.