Repository navigation
fix: preserve local wait budgets across wall-clock changes - #199951
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Timing proof against main 7997daf. Both stepped main runs and both stepped candidate runs completed for every site, with unstepped controls. All runs used ocx on macOS with isolated HOME/state; only the tested process's Date.now changed after its deadline was seeded. performance.now and the system clock were untouched.
Unstepped behavior matched. Followup observation kept the accepted agent as sole delivery owner and every observed agent.wait timeout was a positive integer. Auth unlimited budgets and upstream epoch deadlines retained their behavior; upstream epoch deadlines intentionally remain outside this local-budget repair. Handoff closed commands still joined their helper beyond the ordinary response allowance. Every child process was closed. Proof tiers: source for auth and handoff (real source imports and real child pipes); vitest-source for followup and daemon boundaries. The Windows cases are unit-level native-boundary fixtures on macOS, not live Windows proof. Followup uses the production send entry point with a Gateway transport fixture. Auth operations are delayed promises receiving the real abort signal. These timings do not claim full OAuth, Gateway/model, installed updater, or Task Scheduler E2E coverage. Candidate head: 6a095fb. Host-isolation gate passed: only the five TypeScript wait owners and the followup consumer test changed; no package, install, scripts, hooks, or src/security paths changed. Full tier also passed at this head: dist plus declarations, canonical packed-tarball integrity validation, and isolated packed CLI version/help smoke (the packed entry point reported 6a095fb). All 75 focused consumer tests, changed-file formatting/lint, and targeted type diagnostics passed. |
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR moves five process-local wait budgets to the existing monotonic clock while preserving exchanged epoch deadlines. Example: The wall clock advances ten minutes while an accepted exec continuation remains active.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs concrete local-budget failures still present on main. The pinned diff has no actionable correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAgent execution, Windows service control, and managed-update orchestration consume timeout allowances and asynchronous outcomes; their existing owners decide completion, escalation, or timeout. flowchart TD
A[Agent or service operation] --> B[Existing wait owner]
B --> C[Monotonic local budget]
B --> D[Gateway provider or child process]
C --> E[Completion or timeout]
D --> E
F[Upstream epoch deadline] --> B
Technical reviewBest possible solution: Use the existing monotonic owner for these local budgets while retaining epoch-valued external deadlines and existing lifecycle settlement ownership. Do we have a high-confidence way to reproduce the issue? Current-main arithmetic exposes the clock-step failure directly, and submitted paired built-entry-point receipts demonstrate it for auth and exec followups; this read-only review executed no target code. Is this the best way to solve the issue? This is the smallest complete repair for the five selected owners: replace local clock arithmetic, retain existing policy and external epoch contracts, and align affected fixtures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5e69e0c1eb66. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +16, Tests -4. Total +12 across 8 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 HistoryReviewed November 16, 2026, 1:10 AM ET / 06:10 UTC (Revision 3). |
|
Addressed the settlement fixture clock finding at a3e85ac. The failure cases now advance the existing shared timeState for simulated PowerShell work. That same state already drives Date.now, performance.now, and mocked sleep. The private wall-clock override is removed; unavailable-settlement, exact 330,000ms budget, and no-false-restart assertions are retained. Observed validation through ocx on this head:
This followup changes only consumer test fixtures. All five production owners are unchanged from the paired timing measurements in #199951 (comment). Whole-PR deltas remain production +16 lines and tests -4 lines; no src/security paths changed. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Maintainer override: the only blocking CI validation failure is inherited from this run's main parent, not introduced by this PR.
Both CI and the main-parent replay report: The main-parent replay exited 1 with 0 warnings and 1 error. This PR does not change that file or the lint rule/configuration. Its changed-file lint passed; no unrelated source repair or CI rerun was performed. The failed ci-gate is downstream of this inherited lint failure: https://github.com/openclaw/openclaw/actions/runs/43806472740/job/133108508938. The additional failed ci-gate status links to https://github.com/openclaw/openclaw/actions/runs/43809770205. This is the Security Review workflow_run publisher: its resolve and review jobs succeeded, and its review job explicitly targets PR 199951, head a3e85ac, CI run 43806472740 attempt 1. It reflects the same inherited CI failure, not another failed validation job. Current-head cancelled jobs: 0. |
|
Built-entry-point timing proof for main 7997daf and candidate a3e85ac. Both sides used full dist/declaration artifacts. Runs went through ocx with isolated HOME/state/config and task-owned loopback fixtures. No production code changed. Only the tested process's Date.now was stepped by a preload; performance.now, timers, timeout budgets, and upstream deadline callbacks were not replaced. Runtime auth: shipped agent --localCommand shape: A task-owned provider performs real loopback HTTP credential exchanges: profile A rejects with HTTP 401 after 350ms; profile B takes 12,000ms. The clock steps about 158–168ms after the actual runtime-auth seed, while the first exchange is pending. The CLI legitimately spends some of its ten-second command budget before constructing runtime auth, so the measured seeded budgets—not an assumed ten seconds—are listed below.
On main, forward steps cause the shipped credential-resolution timeout before profile B enters. Backward steps allow profile B's auth exchange to finish over three seconds beyond the real allowance. The candidate aborts at the real allowance in both directions. Important bound: main's late backward exchange does not produce a successful turn; an independent state-ownership renewal fence subsequently rejects it. No late inference success is claimed. An additional unstepped fast control uses two 350ms exchanges: both artifacts exit 0, send one real streamed Read-only inspector coverage records one real Selected shipped CLI receipt fields (unrelated diagnostic metadata omitted; elapsed measurements above use the natural monotonic clock): Exec approval followup: shipped Gateway and CLI exportThe real built Gateway first handles a model-generated exec and an operator allow-once approval, recording its actual printf output. The owner then sends supported The local provider's continuation response remains pending for 375 seconds and emits genuine assistant content every 15 seconds. Stepped cases and the pending unstepped control use the same transport/config. The +600,000ms Date.now step occurs only after BOTH the exact owner's first wait (deadline seeded) and the actual continuation provider POST (runtime handoff consumed).
The pending provider is still active when observation ends. The shipped warning retains the accepted agent run as sole delivery owner. Read-only inspector observations reach Selected redacted runtime receipts: {"case":"main-step-1","elapsedMs":60004.860,"outcome":"observation_ended","waitTimeoutsMs":[60000],"operatorApprovals":2,"actualContinuationPOST":true,"providerStillPending":true,"directDeliveries":0,"tracerErrors":0}
{"case":"candidate-step-1","elapsedMs":360017.721,"outcome":"observation_ended","waitTimeoutsMs":[60000,60000,60000,60000,60000,59965],"operatorApprovals":2,"actualContinuationPOST":true,"providerStillPending":true,"directDeliveries":0,"tracerErrors":0}
{"case":"unstepped-pending-control","elapsedMs":360013.109,"outcome":"observation_ended","waitTimeoutsMs":[60000,60000,60000,60000,60000,59968],"directDeliveries":0,"tracerErrors":0}Setup-only runs that stepped before handoff consumption, or used SSE comments without real progress and hit the unchanged 300-second no-progress watchdog, are excluded. The final matrix uses matched genuine progress; no watchdog, timeout constant, owner implementation, or timer was altered. Proof bounds and CIThis is full built-artifact CLI-local auth and WebChat/Gateway approval proof with deterministic loopback providers, not an external-provider or external-channel certification. The two Windows schtasks sites retain unit-level proof only. Managed update handoff retains the earlier source-level real-child-pipe proof only; no update was run against an installation. Owned runtime processes and state were cleaned up; no host clock or live Gateway changed. The head remains a3e85ac. The inherited check-lint-core-2 failure was reproduced on this CI merge's exact main parent and receipted separately: #199951 (comment). |
|
@clawsweeper re-review New full-tier shipped CLI/Gateway clock-step receipts and matched controls are posted at #199951 (comment). Head remains a3e85ac; no additional production changes. The exact-main-parent inherited CI receipt is linked in the updated PR body. |
|
🦞👀 Re-review progress:
|
|
Landed in 1e54e8b. |
…199951) fix: keep five local elapsed-time waits on the monotonic clock Five local waits measured elapsed time with the wall clock, so a clock step (NTP correction, sleep/wake, manual change) ended them early or let them overrun: the exec-approval follow-up wait, the runtime auth deadline, the managed update handoff response wait, and two Windows scheduled-task waits (process exit and settlement). They now use `src/shared/monotonic-time.ts`, passing `monotonicNow` to `scheduleAbsoluteDeadline` where it's used. Epoch values that cross process, RPC or persistence boundaries stay epochs, RPC timeouts stay integers, upstream epoch auth deadlines are untouched, and the handoff `closed` command keeps its helper-owned settlement. No new text. Evidence: full-build CLI with the process-local Date.now stepped by a preload in that process only, main twice and this change twice, plus unstepped controls. Exec-approval follow-up: main ends after about 60 s; this change waits the real ~360 s, the same as unstepped. Runtime auth: a forward step makes main expire after ~367 ms of a ~9.3 s allowance and a backward step makes it overrun to ~12.4 s; this change keeps the allowance and aborts on time. The Windows scheduled-task sites have unit-level proof with a stepped clock, and the handoff wait has source-level proof through a real child pipe. 75 consumer and 55 daemon tests pass; full build and packed smoke pass. CI red is inherited from main (receipt: openclaw#199951 (comment)). Receipts: openclaw#199951 (comment). Supersedes the closed per-site PRs openclaw#181942, openclaw#187439, openclaw#190976, openclaw#195457, openclaw#199640 and openclaw#199665. Co-authored-by: Ayaan Zaidi <[email protected]>
Main's coverage consolidation (openclaw#198936) deleted schtasks.startup-fallback.test.ts. This branch had split that file, and its schtasks.startup-fallback-lifecycle.test.ts held 14 cases that are byte-identical moves of the deleted ones, so they go too. The shared fixture support keeps only what the activation-provenance regressions import. Main's deadcode repair (openclaw#200313) then removed Scheduled Task fixture helpers that had no remaining main callers. The provenance regressions still use them, so restore those helpers verbatim (createSchtasksNativeFixture, the task snapshot builders, isProcessSnapshotQuery, writeNodeScript, and the probe/response types). The settlement budget case added in openclaw#199951 asserts that restart ends exactly at the stop budget. With this branch, restart then waits out the 15s post-/Run activation window before refusing an unverified activation, so the restart variant now expects the stop budget plus 15s. The stop-only variants are unchanged. Focused daemon suites: 12 files, 242 tests pass.
What Problem This Solves
Local waits can end early or overrun their allowance when the system wall clock changes, affecting accepted exec followups, runtime auth, process exit, Scheduled Task settlement, and managed update handoffs.
User Impact
These five waits retain their elapsed-time budgets across wall-clock corrections. Existing messages, persisted timestamps, RPC epochs, and helper-owned shutdown settlement are unchanged.
Why This Change Was Made
Reuse the existing monotonic-time owner for local budgets and explicitly select its clock in the handoff scheduler. Keep integer agent.wait timeouts with Math.ceil. Runtime auth converts only its internally created startup budget: upstream command-queue epoch deadlines remain epochs and can still be affected by clock corrections. The handoff closed command still joins its helper without a shorter parent timeout.
Evidence
Prior Reports
Supersedes the closed per-site PRs #181942, #195457, #187439, #190976, #199640, and #199665. Thanks to @mikasa0818, @shuisadev, and @SunnyShu0925 for those prior reports.
Two-way door: reverting restores the old local wait calculations; no stored data, configuration, or public protocol changes. Blast radius is limited to these five wait owners.