Skip to content

fix(relay): check clock skew on every cell production.tfvars declares - #28786

Merged
nwparker merged 3 commits into
stablyai:mainfrom
zanmlakar:zanmlakar/relay-clock-skew-cells
Oct 16, 2026
Merged

nwparker merged 3 commits into
stablyai:mainfrom
zanmlakar:zanmlakar/relay-clock-skew-cells

Conversation

@zanmlakar

Copy link
Copy Markdown
Contributor

ELI5

Once an hour, a job checks that every relay server's clock is right, because a wrong clock once broke connections for everyone on that server. The job had a hard-coded list of servers 1 to 22, but there are now 35, so 13 of them were never checked, including all the Asia ones. Now the job reads the server list from the same config file that defines the servers, so a new server gets checked from its first run.

What Changed

  • Before: the measuring step looped over c1 to c22 (seq 1 22). Cells c23 to c35 were never probed, and the run still passed.
  • After: the job does a sparse checkout of only cloud/infra/terraform/environments/production.tfvars. It then reads every hostname in the file's relay_gce_cells block, which is the same block Relay Ops' relayOpsCellsFromTerraform reads. Today that gives c1 to c35. Fenced cells stay in the list as before. They log "not serving" and are named, not judged.
  • New failure: if the list comes out empty, because the file is missing or the block was renamed, the job fails with read no relay cells from production.tfvars; monitor blind. Before, it would have passed without checking anything.
  • Unchanged: the probe itself, the 2 s alarm, and the existing failure when no cell is serving.

Why

Details are in #28775. To be clear about the stakes: since #10474, current desktops accept 30 s of host-proof clock skew, so a drift like the one in the August incident wouldn't break them today. But this monitor is still the only thing that measures relay clocks, and its 2 s alarm can't warn about cells it never probes.

Alternatives considered:

  • Raising the bound to 35: this works today and breaks again at c36. The old comment already asked people to keep the bound up to date, and that was missed.
  • Asking Relay Ops for the list: this would mean installing the cloud workspace every hour just to read a list that a few lines of awk can read from the file Relay Ops parses.
  • Grepping the whole file for hostname = "c…": this gives the same result today, but scoping it to relay_gce_cells keeps it in step with what Relay Ops reads if another block ever declares a hostname.

Linked Issue

Fixes #28775

Visual Proof

N/A. This changes a scheduled cloud operations workflow and adds a test; there's no UI or app behavior change.

Testing

  • New test: cloud/dev/scripts/relay-clock-skew-monitor-workflow.test.mjs takes the measuring step's script out of the workflow and runs it with bash, using the real production.tfvars and a stub curl. It checks that the step probes exactly the cells the file declares, in order. It checks that the step fails when the file is missing or the block is empty. It also checks that the checkout fetches the file the step reads. All 3 tests pass. Against main's workflow, all 3 fail.

  • Parser: the awk reads c1 to c35 from main's production.tfvars under both mawk and gawk.

  • CI coverage: Cloud Verify won't run the new test until test(cloud): run every cloud script test by glob and fix the staging deploy-arguments test #28785 lands, because cloud/package.json currently lists its test files by hand. Once that lands, it picks up the new test automatically.

  • Not tested: the monitor itself against the live cells. It only runs on its hourly schedule or by manual dispatch, only when ORCA_CLOUD_OPERATIONS_ENABLED is set, and a fork can't dispatch it.

  • Platforms: Linux only. The workflow runs on ubuntu-latest.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Written with Claude Code (Claude Opus 5.5).

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@zanmlakar
zanmlakar requested a review from Jinwoo-H as a code owner October 14, 2026 17:10
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5cb13187-b0d4-4c0b-9d99-dcae7442cd0e
📥 Commits

Reviewing files that changed from the base of the PR and between 9fa50a3 and 2054ee3.

📒 Files selected for processing: 3
  • .github/workflows/cloud-monitor-relay-clock-skew.yml
  • cloud/dev/scripts/relay-clock-skew-monitor-workflow.test.mjs
  • cloud/package.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

Copy link
Copy Markdown
Contributor

Thanks @zanmlakar. I merged current main into this branch and added the new test to cloud/package.json's explicit test list. Cloud Verify now runs it without waiting for #28785; once that lands, its glob picks the test up anyway. Codex review found no issues.

@nwparker
nwparker merged commit 69ff84d into stablyai:main Oct 16, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Relay clock-skew monitor only checks cells c1–c22, so c23–c35, including every Asia cell, are never checked

2 participants