Skip to content

fix(update): show new releases without waiting for a second daily check - #181949

Merged
steipete merged 2 commits into
openclaw:mainfrom
holgergruenhagen:fix/update-notice-telemetry-throttle
Oct 31, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
holgergruenhagen:fix/update-notice-telemetry-throttle

Conversation

@holgergruenhagen

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a new stable release reaches update.status, the sidebar update card and the Control UI inbox up to two days after it was published, while openclaw update status reports it right away, when the Gateway runs the stable channel without automatic updates.

User Impact

User impact: the Gateway update notice shows a new stable release within an hour of the daily telemetry check that found it, instead of waiting for the update check's own next daily run.

Affected: every package install on the default stable channel with update.auto.enabled off (the default) and update checks on (the default). The same applies with auto-update on when an external supervisor owns updates, because that path also takes the version from telemetry. Auto-update, beta, extended-stable and dev keep their npm lookups, throttles and rollout delays unchanged.

Why This Change Was Made

Two daily timers run independently and the notice needs both:

  1. Gateway maintenance pings telemetry.openclaw.ai/api/latest-version and caches the answer for 24 h (telemetry.updateCheck, src/infra/telemetry.ts, re-run every 5–10 min in src/gateway/server-maintenance.ts, effective once per day). CLI runs refresh the same cache.
  2. The Gateway update check (runGatewayUpdateCheck, src/infra/update-startup.ts) reads that cache only when its own task runs: at startup and then every 24 h (resolveCheckIntervalMs), and it returns early when its last check (update.checkState.lastCheckedAt) is less than 24 h old. For stable without auto-update the version comes only from the cache (version: telemetryUpdate?.version).

So a release found by the maintenance ping waits until the update check's next daily run, and a Gateway restart in between skips the check on the throttle. The seam is between the telemetry cache owner and the update-check owner; this change lets the update check follow the cache:

  • stable package installs re-read the local cache hourly (the interval auto-update already uses). This reads local state only; the telemetry request count does not change because the cache keeps its 24 h lifetime;
  • a cached release newer than the one already published (or than the installed version) bypasses the 24 h throttle once. After it is published, lastAvailableVersion matches and the throttle applies again.
Lines
Production (src/infra/update-startup.ts) +15 / −3
Tests (src/infra/update-startup-cached.test.ts) +132 / −2
Docs (docs/gateway/telemetry.md) +3 / −1

No new scheduler, no new state, no change to the telemetry request or its consent rules.

Evidence

Production timeline (2026.10.5 installed, stable, auto-update off):

Time (UTC) Event
2026-10-22 12:44:56 2026.10.6 published on npm latest
2026-10-22 16:36:36 Gateway update check runs, telemetry cache still holds 2026.10.5 → update.checkState {"lastCheckedAt":"2026-10-22T16:36:36.554Z","lastNotifiedVersion":"2026.10.5"}, no lastAvailableVersion
2026-10-22 21:16:40 Gateway restart; update check skipped by the 24 h throttle
2026-10-23 02:43:39 shared telemetry cache refreshed: {"lastPingAt":1792723419731,"latestVersion":"2026.10.6"}
2026-10-23 15:45 update.status → updateAvailable: null; inbox shows nothing; openclaw update status shows 2026.10.6
2026-10-23 21:17:44 next scheduled update check (24 h after the restart): first notice, ~32.5 h after release and ~18.5 h after the Gateway already had the version cached. Observed at 21:30: update.checkState {"lastCheckedAt":"2026-10-23T21:17:44.423Z","lastNotifiedVersion":"2026.10.6","lastAvailableVersion":"2026.10.6"}, update.status → updateAvailable: {"currentVersion":"2026.10.5","latestVersion":"2026.10.6","channel":"latest"}

The worst case is close to 48 h: a ping just before the release keeps the old version for 24 h, and the update check can run just before that cache expires.

Live before/after on an isolated Gateway (loopback, own state, package copy without .git so the install is detected as package, OPENCLAW_TELEMETRY_ENDPOINT pointed at a local stub that answers with the installed version). Same script for both builds:

  1. start once so the Gateway creates its state, stop;
  2. write the production situation into the state DB: update check 1 h ago without a finding, telemetry cache refreshed 30 min ago with 2026.10.7;
  3. restart and read update.status.
Build update.status.updateAvailable after restart update.checkState after restart
base 7845dd3eb29 null (17:00:17Z) unchanged, lastCheckedAt 1 h old
fix fce5dc4dbe3 {"currentVersion":"2026.10.6","latestVersion":"2026.10.7","channel":"latest"} (17:16:03Z) lastAvailableVersion: "2026.10.7", lastNotifiedVersion: "2026.10.7"

No telemetry request reached the stub during step 3 in either run; both builds used the cached value.

Fix run, step 3 (excerpt)
--- 2026-10-23T17:16:03Z update.status
{
 "updateAvailable": {
  "currentVersion": "2026.10.6",
  "latestVersion": "2026.10.7",
  "channel": "latest"
 },
 "effectiveChannel": "stable",
 "schedule": {
  "channel": "stable",
  "autoEnabled": false,
  "install": { "kind": "package" },
  "target": { "kind": "package", "version": "2026.10.7" }
 }
}
--- Telemetry requests at the stub during step 3:
--- Log lines 'update available':
2026-10-23T19:15:56.586+02:00 update available (latest): v2026.10.7 (current v2026.10.6). Run: openclaw update

Tests (Linux, Node 24.22.1, --maxWorkers=1):

  • src/infra/update-startup-cached.test.ts: 9 passed, 64 s. New cases run the real runGatewayUpdateCheck / createGatewayUpdateCheck owners against the state DB with the scheduler test clock (no sleeps or timers): cached release published within the throttle (new, and newer than an already published one); throttle kept when the cached release is already published or not newer; auto-update throttle unchanged (no npm lookup); hourly scheduled re-read publishes a refreshed cache one hour later.
  • Counter-check: without the production change 3 of the new cases fail; with only the throttle bypass (daily interval kept) the scheduled case still fails, so both parts are needed.
  • All tests that use the changed owner: 17 files (src/infra/update-startup*.test.ts, src/infra/telemetry*.test.ts, src/gateway/server-startup-update-check.test.ts, src/gateway/server-methods/update-*.test.ts, src/cli/update-cli.candidate-activation.test.ts, …), 322 passed, 724 s.
  • oxfmt --check, oxlint --type-aware on changed files, check-test-mock-exports: clean.

Gap: the hourly re-read was not observed live (it needs an hour of wall-clock time per run); it is covered by the scheduler-clock test above.

Context: #64807 reported the same class (dashboard uses a throttled Gateway cache, CLI checks live) before the telemetry cache existed; it was closed by the reporter without a code change. #128424 introduced the daily telemetry ping that added the second 24 h layer.

Stable installs without auto-update take the available version from the telemetry ping cache, which Gateway maintenance refreshes on its own daily deadline. The Gateway update check only re-read that cache every 24 hours and then returned early on its own 24-hour throttle, so a release could reach update.status, the sidebar card and the inbox up to two days after it was published.

Re-read the local cache hourly for stable package installs and let a cached release newer than the one already published bypass the daily throttle. Auto-update, beta, extended-stable and dev paths keep their npm lookups and throttles.
@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S labels Oct 23, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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. labels Oct 23, 2026
@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR checks cached stable-release availability hourly and publishes newer cached releases without waiting for the daily discovery throttle.

Example: OpenClaw 2026.10.6 runs on stable with automatic updates disabled, a discovery check from one hour ago, and telemetry already caching 2026.10.7.

  • Before: Restarting the Gateway leaves update.status.updateAvailable null until the daily discovery throttle expires.
  • After: Restarting publishes 2026.10.7 immediately, and a running Gateway checks for refreshed cached availability hourly.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with real Gateway before/after output, distinct regression coverage, unchanged persisted formats, and no actionable findings; required CI is still pending.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The contributor's isolated package-mode Gateway restart exercises the changed discovery owner through update.status on the pinned base and head, showing cached 2026.10.7 becoming available only after the fix without a telemetry request; hourly scheduling has a distinct scheduler-clock regression and was expressly not observed for an hour live.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: The Gateway can hide a stable release it already knows about until a second daily deadline, while CLI status reports the update.
Reason: Timely publication of known availability has clear user value, and the focused repair preserves existing channel, consent, and installation ownership.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a source-confirmed delay that remains on current main, using the existing update owner without introducing competing state or policy; no actionable patch defect was found.

Priority: P2
Reviewed head: fce5dc4dbe360ae0c1ab9eb82e61bbca065714c1

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway maintenance refreshes the shared telemetry cache; the update-check lifecycle consumes that cache and saved channel policy, then publishes availability to status RPCs and connected clients.

flowchart LR
  A[Gateway maintenance] --> B[Telemetry cache]
  C[Update scheduler] --> D[Update discovery owner]
  B --> D
  E[Saved update policy] --> D
  D --> F[Availability and schedule]
  F --> G[Status RPC and Control UI]
Loading

Technical review

Best possible solution:

Merge the focused discovery-owner fix once the required checks pass, preserving the existing telemetry cadence, consent gates, and automatic-update policy.

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

The daily scheduler and early throttle return establish the failure on current main, and the contributor supplies matching before/after Gateway output; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch addresses both necessary causes within the existing owner: hourly cache observation and publication of newer cached releases despite the daily throttle.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 1ba6f92d4074.

Provenance checked

  • Discovery scheduling changes intended behavior with a stated reason (cbaa21e: Hot-reloaded update policy uses the existing lifecycle and interval owner.)
  • Channel-scoped discovery throttle keeps the original intent (12092aa: Persisted availability belongs to its saved channel, and channel changes must bypass stale discovery state.)
  • Daily telemetry cache keeps the original intent (4d617f4: Share one daily update request with optional consented statistics and retain a canonical cached result.)
  • Cached installation-status publication keeps the original intent (6b09b3b: Publish discovered installation facts before the throttle so cached startup checks retain accurate status.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +12, Tests +130, Docs +2. Total +144 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 15 3 +12
Tests 1 132 2 +130
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 150 6 +144

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Stable package users can receive update notices substantially later than the release already cached locally, while explicit updates remain available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 October 23, 2026, 5:58 PM ET / 21:58 UTC.

@steipete
steipete merged commit 12dcf73 into openclaw:main Oct 31, 2026
116 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
…ck (openclaw#181949)

* fix(update): show new releases without waiting for a second daily check

Stable installs without auto-update take the available version from the telemetry ping cache, which Gateway maintenance refreshes on its own daily deadline. The Gateway update check only re-read that cache every 24 hours and then returned early on its own 24-hour throttle, so a release could reach update.status, the sidebar card and the inbox up to two days after it was published.

Re-read the local cache hourly for stable package installs and let a cached release newer than the one already published bypass the daily throttle. Auto-update, beta, extended-stable and dev paths keep their npm lookups and throttles.

* Merge branch 'main' into fix/update-notice-telemetry-throttle

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

Labels

clawtributors PR from a clawtributor docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

3 participants