Skip to content

fix(relay): gate the Asia canary on Asia-targeted region fallbacks only - #24320

Merged
Jinwoo-H merged 2 commits into
mainfrom
relay-asia-canary-fallback-baseline
Oct 1, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
relay-asia-canary-fallback-baseline

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​14
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​14

ELI5

Before a new Asia relay cell starts taking users, the rollout runs a five-minute trial and checks that nothing went wrong. One check was "no host was placed outside the region it asked for." That count is never zero in production, for reasons that have nothing to do with the new cell, so the trial could not pass. This change makes the check look only at the hosts a new Asia cell could actually affect.

What Changed

Before: promoting production-gce-c31 ran a real five-minute trial that worked. Its own test connection landed on C31, and C31 picked up 18 real hosts. The rollout still failed with C31 canary regionFallbacks did not match the intentional probes and put C31 back to migration-only. Any new Asia cell would fail the same way.

After: the production trial fails if any host that asked for Asia was placed outside Asia. Fallbacks for hosts that asked for the US, or sent no region and so default to the US, are still counted. They are written into the evidence file but no longer fail the trial. Staging keeps its exact rule of one intentional fallback.

Mechanism: the director counts fallbacks by the region the host was aiming for, not the region it landed in. In production every fallback was aimed at us-central1. These are placement-lane requests from unhinted or US-preferring hosts. An Asia cell cannot cause them, so they are recorded but not gated. The evidence script now also records asiaRegionFallbacks and gates on that number alone. All other gates are unchanged: unavailable regions, Asia selections, SQL failures, pool waits, and the check that the test connection landed on the new cell.

Measured with the workflow's own log query:

Window (2026-10-01 UTC) Fallbacks aimed at Asia Fallbacks aimed at US Asia selections Unavailable
07:26:27 to 07:31:27, before the trial 0 130 1234 0
07:31:27 to 07:36:34, the trial 0 143 1290 0
07:38:00 to 07:43:00, after rollback 0 89 818 0

Why

Three alternatives were considered.

  • Keep zero as the target. It fails whenever unrelated US-aimed fallbacks occur during the trial, as they did here.
  • Compare against the five minutes before the trial. This would also have failed this run, because 143 is more than 130. The US-aimed count changes between windows for reasons unrelated to the cell. Passing would need a hand-picked tolerance.
  • Count fallbacks per cell. The director does not record which cell was involved, only the target region. Counting by target region is the attribution that exists, and it separates cleanly here. A dead cell is already caught by the trial's own connection and by the cell's control and splice minimums. The rule that Asia-aimed fallbacks stay at zero is an extra check on top of those.

Linked Issue

Fixes #N/A. This is an internal rollout gate fix with no issue.

Visual Proof

N/A. This changes a deploy workflow's evidence script and docs, with no UI.

Testing

  • node --test passes on the evidence script tests, the Asia topology and admission tests, and the tests that pin the relay workflows doc.

  • A new test copies C31's trial: US-aimed fallbacks pass and are recorded, and one Asia-aimed fallback fails.

  • Replay of the real trial logs from run 36830733912: the old script fails with the production error, and the new script passes. Every other gate still reads zero or stays within its bound.

  • I manually tested these changes locally

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

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Only the production rollout gate is affected. It has no runtime, SSH, mobile, or cross-platform impact.

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)

…nary baseline

Claude-Session: ced32ebb-7155-4413-adad-1eccd14c2010

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Production canary gate rekeyed to Asia-targeted fallbacks — runtimeMetrics now derives asiaRegionFallbacks from regionFallbacksDelta['asia-east2'], and the production canary fails only when that count is non-zero; US-targeted fallbacks remain recorded but ungated.
  • Staging gate preserved — assertPassingRuntimeMetrics dropped its expectedRegionFallbacks parameter, with staging asserting its one intentional us-central1 fallback inline (identical behavior).
  • Regression test added — mirrors C31's real trial: 144 US-targeted fallbacks pass and are recorded, a single Asia-targeted fallback throws.
  • Docs updated — relay-workflows.md explains the target-region keying and the Asia-only gate.

The mechanism holds up against the producer: relay-observability.ts:268 keys regionFallbacks by target region, and app.ts:406 marks a fresh unhinted dial on an existing Asia pin as a us-central1-keyed fallback even when sticky assignment succeeds, so the US-aimed baseline is genuinely independent of a new Asia cell. Verification: node --test cloud/dev/scripts/relay-asia-rollout-evidence.test.mjs — 37/37 pass.

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

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 800c6401-0d5a-478e-be64-9999fd5e2c4f

📥 Commits

Reviewing files that changed from the base of the PR and between 6593d7d and 9ea2e46.

📒 Files selected for processing (3)
  • cloud/dev/scripts/relay-asia-rollout-evidence.mjs
  • cloud/dev/scripts/relay-asia-rollout-evidence.test.mjs
  • cloud/docs/relay-workflows.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough
📝 Walkthrough

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 9ea2e

The canary records US-targeted fallbacks without failing and rejects Asia-targeted fallbacks; staging retains its exact-count checks. No actionable merge risk remains beyond normal CI.

Architecture Summary

Architecture risk: 🟡 Medium · up to 9ea2e

The change affects 1 system.

Changed systems: cloud

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — cloud (service) was modified; 3 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in cloud/dev/scripts/relay-asia-rollout-evidence.mjs: Staging now calls assertPassingRuntimeMetrics without an expected fallback count and separately requires regionFallbacks and usRegionFallbacks to equal 1; the removed call previously checked both counts inside the helper.
  • observed — Modified behavior in cloud/dev/scripts/relay-asia-rollout-evidence.mjs: Production canary evidence now rejects the canary when asiaRegionFallbacks is nonzero. Previously, this block had no explicit Asia-fallback check.
  • observed — Modified behavior in cloud/dev/scripts/relay-asia-rollout-evidence.mjs: runtimeMetrics now aggregates asiaRegionFallbacks from director payloads’ asia-east2 fallback deltas, defaulting missing values to zero.
  • observed — Modified behavior in cloud/dev/scripts/relay-asia-rollout-evidence.mjs: assertPassingRuntimeMetrics drops the expectedRegionFallbacks parameter and removes its checks that total and US-region fallback counts match that value. The Asia-selection check remains.

Reliability and maintainability

  • inferred — Risk-relevant change factors for cloud: blast_radius_1; direct_dependents_1
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely identifies the main change: the Asia canary now gates only on Asia-targeted region fallbacks.
Description check ✅ Passed The description covers the required sections, explains the behavior change and rationale, documents testing, and marks the visual proof as not applicable. The unchecked broad validation commands are e…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

…nary baseline

Claude-Session: ced32ebb-7155-4413-adad-1eccd14c2010
@Jinwoo-H
Jinwoo-H merged commit 94f6c53 into main Oct 1, 2026
26 of 28 checks passed
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High risk] Changes canary validation logic for Asia region rollout.

The PR should not merge until the canary accounts for US-targeted placements that the newly promoted Asia cell can serve.

Findings

  1. P1 US fallbacks can involve Asia ▶

Summary

The PR narrows the production relay canary’s fallback gate to Asia-targeted placements while retaining the staging gate.

  • Records Asia-targeted fallbacks separately and tests that US-targeted fallbacks do not fail a production canary.
  • Documents the narrower gate. Ordinary cross-region placement means a newly promoted Asia cell can nevertheless contribute to the ignored US-targeted count.

Reviews (1) · Last reviewed commit: "fix(relay): gate the Asia canary on regi..."

Comment on lines +312 to +316
// Fallbacks are keyed by the host's target region. US-targeted ones come from unhinted or
// US-preferring hosts an Asia cell cannot cause, so they are recorded but not gated.
if (number(metrics.asiaRegionFallbacks, 'asiaRegionFallbacks') !== 0) {
throw new Error(`${canary.label} canary asiaRegionFallbacks must be zero`)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 US fallbacks can involve Asia

When US cells lack placement headroom, ordinary placement can put a US-targeted or unhinted host on a general Asia cell. That fallback is counted under us-central1, even if the newly promoted canary cell serves the host. This gate ignores it, so the canary can pass while promotion increases cross-region US placements.

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