Repository navigation
fix: keep probe timings and cache windows stable across clock corrections - #190894
Merged
Merged
Conversation
Co-Authored-By: Claude Code <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
A wall-clock jump during pause made resume() compute a zero remaining delay and fire the reconnect callback immediately. Co-Authored-By: Claude Code <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
ClawSweeper asked for context-report visibility + wall-clock evidence beyond the bare retry-owner unit. Drive sessionContextReportsForGateway through a retryable sessions.usage failure, hide, jump Date by one hour, show, and assert the 30s backoff still holds. Co-Authored-By: Claude Code <[email protected]>
Match the existing visibility/backoff test harness (full fake timers, watch presented before refresh). Partial Date-only fake timers left a checks-ui shard with request count 0 after refresh. Co-Authored-By: Claude Code <[email protected]>
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
This was referenced Nov 2, 2026
This was referenced Nov 2, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 3, 2026
…ions (openclaw#190894) fix: measure durations, timeouts and cache ages with the monotonic clock Several timeouts, cache TTLs and retry backoffs measured elapsed time with the wall clock. When the system clock jumped (NTP correction, sleep and resume, manual change), they fired too early, never fired, or ignored server backoff. These callers now use the monotonic clock (`src/shared/monotonic-time.ts` in core, `performance.now()` in extensions). Stored and displayed timestamps stay on the wall clock, and SDK signatures and public epochs are unchanged. This sweep includes openclaw#190846, openclaw#190852, openclaw#190853, openclaw#187703, openclaw#187689, openclaw#187782, openclaw#187765, openclaw#189161, openclaw#189160 and openclaw#190098, with the contributors' commits kept for credit. Evidence: built Gateway, CLI and real Chromium, main twice and candidate twice, stepping only the process wall clock (`Date.now`); no system clock change. On main, a Discord deployment timeout aborted or overran after a 60-second step, the Chromium context popover retried after about 100 ms despite server backoff, and the `sessions.usage`, Pi session catalog and GitHub project caches refreshed too early or too late. With this change, each followed real elapsed time. Ordinary controls passed, and epoch timestamps were unchanged. Details: openclaw#190894 (comment). Thanks @Alix-007, @chengzhichao-xydt, @huwei-xydt. Co-authored-by: Alix-007 <[email protected]> Co-authored-by: chengzhichao-xydt <[email protected]> Co-authored-by: Claude Code <[email protected]> Co-authored-by: 胡伟0668000622 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
This was referenced Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes misleading probe and timeout diagnostics, stale cached results, and premature context-breakdown retries when the host wall clock is corrected while OpenClaw is running.
User Impact
Operators get elapsed durations and cache/retry windows that follow actual time passed, rather than clock corrections. Stored session timestamps, report dates, public probe start/end epochs, timeout budgets, and SDK callback contracts remain unchanged. No configuration or state migration is required.
Why This Change Was Made
Use the existing process-local clock owner in core and the Control UI, and
performance.now()inside extensions. Keep wall-clock readings only where an epoch is part of the existing contract. The usage-cache completion check also accepts a valid zero-valued monotonic reading.Preserves the contributor commits by Alix-007, chengzhichao-xydt, and huwei-xydt from #190846, #190852, #190853, #187703, #187689, #187782, #187765, #189161, #189160, and #190098. Existing owner regressions cover freshness, cooldown, cancellation, timing snapshots, zero-valued clock readings, and retry backoff; duplicated clock-only fixtures and allocation notes are removed. Against frozen main
dd96854d2e94c15b1e37946e962b27078a127f37: production +55/−38, tests net 0 lines, documentation +4/−3, wrapper inventory +1. The production growth is the existing clock imports, the separate public-epoch/elapsed readings, and explicit cache clock-domain names—not a new abstraction or exported SDK surface.Evidence
Built Gateway and CLI artifacts in secretless Node 24.22.1 Docker; real Chromium for the Control UI. Each affected operator workflow was exercised twice on frozen main and twice on the candidate, with ordinary-flow controls. Clock proof uses process-local
Date.nowwall-clock steps, as in #188293; no system clock was changed and native elapsed clocks/timers were not accelerated.sessions.usageand Pi catalog reads: main retained expired entries after a backward step; the candidate refreshed after the real 30-second TTL. A forward step caused premature usage refresh only on main. Persisted session epochs and Pi source files stayed unchanged.gateway probe, standalonemodels status --probe, Slackchannels.status, and BravewebSearch.test: main reported negative or roughly 60-second-inflated durations; the candidate reported ordinary elapsed durations. Auth/refusal classifications and public wall-clock timestamps were preserved.projects.searchRemote: main refreshed too early after a forward step and stayed stale after a backward step; the candidate respected the real 60-second TTL in both directions.channels resolvetimeout diagnostics: a forward step made main falsely report about 60 seconds of event-loop starvation; the candidate retained the real 15-second timeout without that hint. A genuinely blocked event-loop control still reported starvation.observed=0s/“was aborted” orobserved=75son main, but approximately 15 seconds/“timed out” on the candidate.Slack, Discord, GitHub, Brave, Telegram, and model-provider peers were task-owned protocol fixtures, not live external accounts. Native client libraries, TLS verification through a task-trusted CONNECT peer where applicable, real request paths, real timer budgets, and captured wire payloads were retained. No live delivery is claimed.
Focused owner checks: 129 tests passed across 12 selected files, plus final zero-reading and unchanged-production consolidation checks; changed-file lint passed all 30 TypeScript files. Before/after screenshots and detailed runtime receipts.
Merge danger: two-way door; reverting restores the previous timing behavior without rewriting persisted data. Blast radius is process-local probe/timeout diagnostics, the shared stale-while-revalidate cache and its existing consumers, Pi candidate discovery, detailed usage-result caching, Discord deployment diagnostics, and the Control UI retry owner.