Skip to content

fix(relay-ops): per-region cell latency bar and attributable preflight failures - #18877

Merged
Jinwoo-H merged 1 commit into
mainfrom
relay-monitor-asia-latency-bar
Sep 5, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
relay-monitor-asia-latency-bar

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​118 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​118
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​26 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24

Why

The relay production monitor evaluates one active probe per minute against every cell's /health and /ready, and freezes the whole 15-minute gate when any cell's cell.<id>.latency_ms exceeds endpointLatencyMs = 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 runs SELECT 1 against 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:

Region /ready p50 p90 max
asia-east2 0.88 s 1.25-2.15 s 2.7 s
us-central1 0.08 s - 0.5 s

Three gates froze on this (runs 33987646501, 33988383401, 33988810139), each on cell.production-gce-c27.latency_ms at 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 / .ready equal-1 checks and the probe's 8 s fetch timeout. Director and auth latency rules are unchanged at 2000.

Threshold shape

IncidentCellExpectation gains region: RelayOpsRegion, populated from the tfvars region already parsed in environment-config.ts. The new threshold is a nested map:

cellEndpointLatencyMs: {
  'us-central1': 2_000,
  'asia-east2': 4_000
} as const satisfies Record<RelayOpsRegion, number>,

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_THRESHOLDS is serialized only into IncidentCheckpoint.thresholds, which is appended to the summary JSONL and re-read in incident-monitor-cli.ts with a bare JSON.parse(line) as IncidentCheckpoint that touches only windowSequence, checkpointMinute, status, sampleCount, failures, expectedSelector, migrationPolicy, recoverySourceCellId and capacityCellId. The one zod schema over persisted monitor data (incident-monitor-cli.ts, and PreflightStateSchema) validates IncidentMonitorState, which has no thresholds field. No script under cloud/dev/scripts/ references endpointLatencyMs or the thresholds object; relay-monitor-evidence.mjs does not read it.

The change is additive: endpointLatencyMs: 2_000 keeps its name and value and still backs the director rule, the auth rule, and probeEndpointHealth in resource-inventory.ts. Old artifacts stay readable.

Attributable preflight failures

incident-live-preflight-cli.ts threw relay live preflight failed: active-probe/threshold_max, which does not say what froze the wave. The source/code token and the comma join are unchanged for tooling that matches on them; the signal name and observed/threshold are appended when present:

relay live preflight failed: active-probe/threshold_max cell.production-gce-c27.latency_ms observed=2568 threshold=2000

A failure with no signal degrades to active-probe/source_stale observed=60001 threshold=60000, and one with neither to relay-logs/source_missing.

Tests

  • incident-monitor.test.ts pins all three sides of the new bar: an asia-east2 cell at 2685 ms is green, an asia-east2 cell at 4001 ms freezes with threshold_max and 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.ts proves directorSignals carries 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.ts pins 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.ts and incident-live-preflight-cli.test.ts gained the required region field.

Verification

Run from cloud/ after CI=true pnpm install --frozen-lockfile:

pnpm --filter @orca-cloud/relay-ops typecheck   clean
pnpm --filter @orca-cloud/relay-ops test        12 files, 95 tests passed
pnpm test                                       633 passed, 0 failed, 87 skipped
pnpm typecheck / pnpm lint (all 4 workspaces)   clean

pnpm test from cloud/ 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. oxlint on the changed files reports "No files found to lint" because the root .oxlintrc.json lists cloud/** in ignorePatterns, so no max-lines budget applies to these files and no disable was added.

…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.
@pullfrog

pullfrog Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit a3c1d32 into main Sep 5, 2026
25 of 26 checks passed
@Jinwoo-H
Jinwoo-H deleted the relay-monitor-asia-latency-bar branch September 5, 2026 20:21
Jinwoo-H added a commit that referenced this pull request Sep 5, 2026
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 585b6643-efa4-4986-9833-aaade94ffb8f

📥 Commits

Reviewing files that changed from the base of the PR and between 9c3d957 and aa436d9.

📒 Files selected for processing (7)
  • cloud/apps/relay-ops/src/incident-live-preflight-cli.test.ts
  • cloud/apps/relay-ops/src/incident-live-preflight-cli.ts
  • cloud/apps/relay-ops/src/incident-monitor-cli.test.ts
  • cloud/apps/relay-ops/src/incident-monitor-sources.test.ts
  • cloud/apps/relay-ops/src/incident-monitor-sources.ts
  • cloud/apps/relay-ops/src/incident-monitor.test.ts
  • cloud/apps/relay-ops/src/incident-monitor.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Incident 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 aa436

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)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides detailed rationale, implementation scope, tests, and verification, but it omits several required template sections. The linked issue is also missing. 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 th…
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes both primary changes: per-region cell latency thresholds and attributable preflight failure messages.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Resolution

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.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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.
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.

1 participant