Repository navigation
fix(relay-ops): per-region cell latency bar and attributable preflight failures - #18877
Conversation
…t failures The incident monitor froze three healthy 15-minute production gates on 2026-09-05 because asia-east2 cells are judged against a bar calibrated for us-central1. A cell's /ready fetches the auth JWKS and runs SELECT 1 against Cloud SQL, both in us-central1, so from the US GitHub runner the asia-east2 round trip measures p50 0.88 s / max 2.7 s against 0.08-0.5 s for us-central1 cells. Give cell.<id>.latency_ms a per-region threshold (us-central1 2000, asia-east2 4000) carried on IncidentCellExpectation from the tfvars region. Director and auth latency rules keep the flat 2000 bar, and hard faults are still caught by the .health/.ready equal-1 checks and the probe's 8 s fetch timeout. Also name the signal and its observed/threshold in the live preflight failure message, keeping the source/code tokens other tooling matches on.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughIncident monitoring now carries each cell's region into incident expectations and applies region-specific cell latency thresholds. Tests cover both configured regions and updated fixtures. The preflight CLI now reports failure source, code, observed values, and threshold values when available. Merge Risk: ⚪ Minimal · up to This updates cell latency monitoring for regional network conditions and makes preflight failures more actionable. The regional thresholds and diagnostic formatting are covered without an identified merge-blocking risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkResolution Add the required ELI5, What Changed, Linked Issue with an issue reference, Visual Proof with N/A and a reason if applicable, Testing checklist, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. Complete the applicable checklist items and document the platforms tested.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
…t failures (stablyai#18877) The incident monitor froze three healthy 15-minute production gates on 2026-09-05 because asia-east2 cells are judged against a bar calibrated for us-central1. A cell's /ready fetches the auth JWKS and runs SELECT 1 against Cloud SQL, both in us-central1, so from the US GitHub runner the asia-east2 round trip measures p50 0.88 s / max 2.7 s against 0.08-0.5 s for us-central1 cells. Give cell.<id>.latency_ms a per-region threshold (us-central1 2000, asia-east2 4000) carried on IncidentCellExpectation from the tfvars region. Director and auth latency rules keep the flat 2000 bar, and hard faults are still caught by the .health/.ready equal-1 checks and the probe's 8 s fetch timeout. Also name the signal and its observed/threshold in the live preflight failure message, keeping the source/code tokens other tooling matches on.

Why
The relay production monitor evaluates one active probe per minute against every cell's
/healthand/ready, and freezes the whole 15-minute gate when any cell'scell.<id>.latency_msexceedsendpointLatencyMs = 2000. That bar was calibrated for the 16 us-central1 cells.A cell's
/ready(cloud/apps/relay/src/relay-readiness.ts) fetches the auth JWKS in us-central1 and runsSELECT 1against Cloud SQL in us-central1 before answering. Measured from the US GitHub runner on 2026-09-05, the asia-east2 cells sit far above the bar for that reason alone:/readyp50Three gates froze on this (runs 33987646501, 33988383401, 33988810139), each on
cell.production-gce-c27.latency_msat 2568 / 2668 / 2685 ms against 2000. 120 operator probes plus c28 and c29 in general admission showed the same tail, so it is path latency, not cell health.Hard faults are still caught by the
.health/.readyequal-1 checks and the probe's 8 s fetch timeout. Director and auth latency rules are unchanged at 2000.Threshold shape
IncidentCellExpectationgainsregion: RelayOpsRegion, populated from the tfvars region already parsed inenvironment-config.ts. The new threshold is a nested map:satisfies Record<RelayOpsRegion, number>makes a future region a compile error rather than a silent fallback.The nested shape is safe because nothing reads the persisted thresholds back.
INCIDENT_MONITOR_THRESHOLDSis serialized only intoIncidentCheckpoint.thresholds, which is appended to the summary JSONL and re-read inincident-monitor-cli.tswith a bareJSON.parse(line) as IncidentCheckpointthat touches onlywindowSequence,checkpointMinute,status,sampleCount,failures,expectedSelector,migrationPolicy,recoverySourceCellIdandcapacityCellId. The one zod schema over persisted monitor data (incident-monitor-cli.ts, andPreflightStateSchema) validatesIncidentMonitorState, which has nothresholdsfield. No script undercloud/dev/scripts/referencesendpointLatencyMsor the thresholds object;relay-monitor-evidence.mjsdoes not read it.The change is additive:
endpointLatencyMs: 2_000keeps its name and value and still backs the director rule, the auth rule, andprobeEndpointHealthinresource-inventory.ts. Old artifacts stay readable.Attributable preflight failures
incident-live-preflight-cli.tsthrewrelay live preflight failed: active-probe/threshold_max, which does not say what froze the wave. Thesource/codetoken and the comma join are unchanged for tooling that matches on them; the signal name and observed/threshold are appended when present:A failure with no signal degrades to
active-probe/source_stale observed=60001 threshold=60000, and one with neither torelay-logs/source_missing.Tests
incident-monitor.test.tspins all three sides of the new bar: an asia-east2 cell at 2685 ms is green, an asia-east2 cell at 4001 ms freezes withthreshold_maxand threshold 4000, and a us-central1 cell at 2001 ms still freezes with threshold 2000. Verified as a real oracle by flipping the asia value to 2000, which fails the test.incident-monitor-sources.test.tsprovesdirectorSignalscarries the tfvars region onto every cell expectation, checking c1 as us-central1, c27 as asia-east2, and every production cell against its configured region.incident-live-preflight-cli.test.tspins the new message for a threshold failure with a signal and for a stale-source failure without one.Fixtures in
incident-monitor.test.ts,incident-monitor-cli.test.tsandincident-live-preflight-cli.test.tsgained the requiredregionfield.Verification
Run from
cloud/afterCI=true pnpm install --frozen-lockfile:pnpm testfromcloud/covers relay-contract (20), relay-fence-broker (16), relay-ops (95), relay (502 passed / 87 skipped) plus 529 node dev-script tests and the 148-test pretest batch.oxlinton the changed files reports "No files found to lint" because the root.oxlintrc.jsonlistscloud/**inignorePatterns, so nomax-linesbudget applies to these files and no disable was added.