Skip to content

feat(relay-ops): allow the migration-only cells c17 and c18 in same-cap waves - #21307

Merged
Jinwoo-H merged 1 commit into
mainfrom
relay-same-cap-c17-c18
Sep 18, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
relay-same-cap-c17-c18

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​294 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​278
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​123 $\color{#cf222e}{\Huge{\mathbf{−}}}$​31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​92

ELI5

Relay runs on a fleet of "cells". Most of them carry real user connections. Two of
them, c17 and c18, currently carry none at all: they are parked and take no new
work. That makes them the safest possible place to try a new cell image, because
if it goes wrong nobody gets disconnected.

The rollout workflow that upgrades a cell refused to touch them, and would have
quietly turned them into live, connection-taking cells if it had. This teaches it
to roll a parked cell and hand it back parked.

What Changed

Before. A canary-apply on c17 failed at the dispatch gate with same-cap wave cells are invalid, because the approved-cell list held only the nineteen serving
cells. There was no way to roll a new image on a cell with zero hosts.

After. c17 and c18 are dispatchable. A wave on either one isolates nothing,
drains nothing, replaces the VM, and returns the cell to migration-only.

The mechanism is a cell's entry admission class, which the wave now carries
end to end instead of assuming every target is a general serving cell:

  • The approved list gains the two cells, with the migration-only ones named
    separately so the rest of the wave can ask which class a cell is.
  • The pre-mutation check demanded general. It now demands the class the
    cell is declared to serve in, so a parked cell passes and a serving cell is
    still required to be pristine and general.
  • Isolate was already a no-op on an already-isolated cell. The job now asserts
    that it changed nothing, which is what proves the wave did not alter the cell's
    class on the way in.
  • Restore unconditionally activated the cell to general. That is correct for a
    serving cell and wrong for a parked one, where it would have promoted c17 into
    the general pool permanently. It now restores the entry class, using the
    idempotent isolate for a parked cell, and verifies the cell ends in that class.
  • Selector membership for the post-restore check moved the target out of
    migration-only and into general. For a parked cell both halves of the wave now
    see exactly the membership it entered with.
  • Selector generation. A serving cell's wave advances it by two (isolate,
    then activate); a parked cell's wave advances it by zero. That number lived in
    three places, all hard-coded to 2: the sealed canary authority, the job's
    per-wave offset, and the live preflight. All three now take it from the cell's
    class. The preflight grew a --selector-wave-delta option, defaulting to the
    old value of 2.
  • Mixing is refused. Every cell after the first in a wave offsets from one
    per-wave delta, so a wave holding both classes has no single correct offset.
    The dispatch validator rejects a mixed wave before anything mutates.
  • Cell shape. c17 and c18 are 600/60, not the 1,000/60 of the US serving set,
    so they get their own branch in the job's shape table. A census test now
    cross-checks every approved cell's pinned cap against the committed Terraform
    map, which nothing did before.
  • Rehome trust. The job required every US cell to be a declared regional-rehome
    source. c17 and c18 are not, so their instance template carries no rehome trust
    lines at all. That guard now fires exactly when either side of a roll expects
    those lines, which is the invariant it was standing in for.

Why

The failing run tonight (35287474065) was a canary-apply on c17 that stopped at the
validator. Adding the two cells to the list alone would have shipped a much worse
bug: the wave would have run to completion and left c17 in general admission,
silently converting a parked cell into one that accepts connections at a 600 cap.

The alternative to the class-aware wave was a special case at the restore step
keyed on the cell id. That leaves the same assumption ("the target is general")
embedded in the precheck, the membership arithmetic, and three separate copies of
the +2, each of which would have failed closed at a different point with an
unhelpful message. Naming the class once and threading it is the same amount of
code and removes the assumption instead of papering over it.

The alternative to the protocol-conditioned rehome guard was adding c17 and c18 to
relay_region_rehome_source_cell_ids. That is a production topology change: it
alters their instance template, makes the director treat them as rehome sources,
and needs an apply of its own. It is also not required to canary an image. The
guard was over-broad, and narrowing it to the condition it actually protects is
the smaller and more honest change.

The limitation this leaves. c17 and c18 can roll only at regional-rehome
protocol 0. A canary on them proves an image boots, serves, and reports the
right digest, cap, and heartbeat; it does not exercise rehome trust. If we want
that, the follow-up is to declare them rehome sources, which is a separate
reviewed apply.

Linked Issue

N/A - operational unblock for the same-cap rollout, no tracking issue.

Visual Proof

N/A. No UI. This changes a GitHub Actions rollout workflow and the scripts it runs.

Testing

All from cloud/.

  • pnpm test — 614 pass, 0 fail in the dev-script suite; 156 pass, 0 fail in
    pretest; per-package: relay-ops 134, relay 717 passed / 121 skipped, push 139
    passed / 4 skipped, postgres-schema 108, relay-contract 35, push-contract 30,
    relay-fence-broker 16. No failures anywhere.
  • pnpm typecheck — clean across all 7 workspace projects.
  • pnpm lint — clean.
  • actionlint on both same-cap workflow files — only the pre-existing unknown
    blacksmith-2vcpu-ubuntu-2204 runner label, which needs an actionlint config
    this repo does not ship. shellcheck is installed locally, so actionlint ran it
    over every changed run: block and reported nothing.

New coverage, all of it executing the real workflow text rather than a copy:

  • The census test extracts the job's class block, its generation arithmetic, and
    its membership derivation, and runs each under bash for both classes. It
    asserts a parked cell's wave produces the entry membership on both sides and a
    serving cell's still swaps the target between the two lists.
  • It asserts the cap resolved for every approved cell matches
    production.tfvars, and that exactly the migration-only cells are absent from
    the rehome source list.
  • It asserts the restore step never activates a parked cell, the precheck reads
    the entry class, the isolate proves changed == false, and the rehome guard
    sits after both protocols are resolved and reads both.
  • The wave validator tests cover rolling each parked cell, rejecting a mixed
    wave, sealing a canary at +0 versus +2, and the new cell-class command.
  • The preflight tests cover both deltas and reject any value no class produces.

Not verified, because it needs the live fleet: that c17 and c18 currently report
a 600 hard cap, a 60 unobserved bound, and rehome protocol 0 from their running
VMs. The job checks all three against the committed Terraform map and fails
closed on a mismatch, so a stale VM surfaces as a failed precheck rather than a
bad roll.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Two things worth a reviewer's attention.

Merging this invalidates any in-flight canary authority. Both the wave
validator and the same-cap job workflow are in TRUSTED_EVIDENCE_CODE_PATHS, so
a canary sealed before this lands cannot authorize a batch after it. Re-run the
canary on the new commit.

A parked-cell canary can authorize a serving-cell batch, at a different rehome
protocol.
The canary authority binds the image digests, run id, and rehome
control generation, but has never bound the per-roll rehome protocol. That is
pre-existing and, as far as I can tell, not a hole: the protocol is validated
per-cell against that cell's own template and live runtime in every batch job,
and the canary's role is evidence about the image. Flagging it because this
change makes a protocol-0-only cell reachable as a canary for the first time.

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

Security: no change to any identity, audience, lock, or confirmation. The break-glass
override path is untouched. The one guard that was relaxed (rehome source membership)
was redundant at protocol 0, because the plan validator independently rejects a
template that carries trust lines the roll did not ask for.

Backwards compatibility: --selector-wave-delta defaults to 2, so every existing
caller behaves exactly as before. The canary authority format is unchanged.

Cross-platform, SSH, mobile, performance: N/A. This is CI-only.

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)

…ap waves

c17 and c18 hold no hosts and sit outside general admission, so rolling one
displaces nobody. They are the only zero-displacement canary for a new cell
image, but the same-cap wave refused them at the dispatch validator and would
have promoted them to general at the end if it had not.

Add them to the approved list and teach the wave a cell's entry admission
class: the precheck demands the class the cell is declared to serve in, the
restore hands it back that class, the isolate on an already-isolated cell is
asserted to change nothing, and the selector generation advances by 2 for a
general cell and by 0 for a migration-only one. One wave may not mix the two,
because every cell after the first offsets from a single per-wave delta.

Neither cell is a declared regional-rehome source, so its template carries no
rehome trust lines. The source-membership guard now fires exactly when a roll
expects those lines instead of for every US cell, which is the invariant it
was standing in for, and which limits c17 and c18 to rehome protocol 0.
@pullfrog

pullfrog Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

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: 1d1de800-9957-4181-8ec8-e519efda24b9

📥 Commits

Reviewing files that changed from the base of the PR and between 754134f and 8765daf.

📒 Files selected for processing (9)
  • .github/workflows/cloud-deploy-relay-production-same-cap-job.yml
  • cloud/apps/relay-ops/src/incident-live-preflight-cli.test.ts
  • cloud/apps/relay-ops/src/incident-live-preflight-cli.ts
  • cloud/dev/scripts/prepare-relay-production-capacity-canary.test.mjs
  • cloud/dev/scripts/relay-production-same-cap-wave.mjs
  • cloud/dev/scripts/relay-production-same-cap-wave.test.mjs
  • cloud/dev/scripts/relay-regional-rehome-workflow.test.mjs
  • cloud/dev/scripts/relay-same-cap-script-census.test.mjs
  • cloud/docs/relay-workflows.md

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


📝 Walkthrough

Walkthrough

The same-cap rollout now supports migration-only cells C17 and C18. The wave script reports each cell's admission and selector-wave delta, and rejects mixed-class waves. The deployment workflow uses those values for generation, preflight, rehome validation, membership, and restore behavior. Migration-only cells use idempotent isolation and general cells use activation. Tests and documentation cover the new classifications and lifecycle rules.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 8765d

The migration-only rollout changes have no identified actionable issue that should block merging.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is detailed and covers the change, rationale, testing, risks, and checklist. However, the required Linked Issue section contains "N/A", despite the template requiring an issue link. Provide the linked issue that this PR addresses in the Linked Issue section. Also include the pnpm build result or state explicitly that CI will cover it if it was not run locally.
Docstring Coverage ⚠️ Warning Docstring coverage is 27.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 7 files. (2 skipped: … 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 the main change: enabling migration-only cells c17 and c18 in same-capacity rollout waves.
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: Docstring Coverage

Explanation

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

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@Jinwoo-H
Jinwoo-H merged commit 399306c into main Sep 18, 2026
25 of 26 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…ap waves (stablyai#21307)

c17 and c18 hold no hosts and sit outside general admission, so rolling one
displaces nobody. They are the only zero-displacement canary for a new cell
image, but the same-cap wave refused them at the dispatch validator and would
have promoted them to general at the end if it had not.

Add them to the approved list and teach the wave a cell's entry admission
class: the precheck demands the class the cell is declared to serve in, the
restore hands it back that class, the isolate on an already-isolated cell is
asserted to change nothing, and the selector generation advances by 2 for a
general cell and by 0 for a migration-only one. One wave may not mix the two,
because every cell after the first offsets from a single per-wave delta.

Neither cell is a declared regional-rehome source, so its template carries no
rehome trust lines. The source-membership guard now fires exactly when a roll
expects those lines instead of for every US cell, which is the invariant it
was standing in for, and which limits c17 and c18 to rehome protocol 0.
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