Skip to content

orb(observability): clock-skew is never sampled in broker mode and reads a hard 0, while the staleness gauge built to catch exactly that is wired to nothing #9156

Description

@JSONbored

Problem

The clock-drift detector built after the #3811 outage never takes a sample on the deployment topology
that runs today, and reads a hard 0 — indistinguishable from "clock is fine".

recordClockSkewFromResponse has exactly one call site: src/github/app.ts:224, inside
requestInstallationTokenWithJwt. In broker mode mintInstallationToken returns from the broker branch
first (src/github/app.ts:241):

if (isOrbBrokerMode(env)) {  return brokered.token; }

A brokered self-host holds no App private key, so the JWT path is unreachable by construction.
lastSkewSeconds stays at its initialiser 0 (src/selfhost/clock-skew.ts:10) and
clockSkewSecondsSample() returns it verbatim (:33) — "0 until the first successful sample".

Both alert rules are abs(loopover_clock_skew_seconds) > 60 / > 120
(prometheus/rules/alerts.yml:552, :564). abs(0) satisfies neither, ever. The Grafana panel
(grafana/dashboards/selfhost.json:2771) asserts perfect clock sync on a host whose clock was never
measured.

The companion gauge loopover_clock_skew_sample_age_seconds — added in #7000 precisely so "a stale
reading is distinguishable from a fresh one", and correctly returning -1 when never sampled — is
referenced by zero alert rules and zero dashboard panels (grep clock_skew_sample_age prometheus/ grafana/ → no hits).

Impact

A placeholder satisfies the health check for its own absence — the same shape as #9008. Drift then
corrupts everything time-derived (cached.expiresAtMs > Date.now() token-grace decisions, run_after
scheduling, cooldown/sinceIso windows, Redis lock TTL reasoning) with no signal, which is the exact
edge-us-01 incident class the module was built for.

Requirements

Test Coverage Requirements

99%+ patch coverage, branch-counted; both arms (sampled / never sampled) and the broker-path sample.

Links & Resources

maintainer-only — observability correctness.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions