Skip to content

fix(relay): the cell switch tool changes only the named switches - #27056

Merged
Jinwoo-H merged 12 commits into
mainfrom
relay-cell-flags-tool-rmw
Oct 10, 2026
Merged

Jinwoo-H merged 12 commits into
mainfrom
relay-cell-flags-tool-rmw

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​709 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​690
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​680 $\color{#cf222e}{\Huge{\mathbf{−}}}$​51 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​629

Summary

The relay cell switch tool (operate-relay-cell-flags, and the production workflow that runs it) used to write a whole switch file built from two inputs, readiness-local and ticket-check. A cell treats every key missing from its file as "use the default", so any write silently reset every other switch on that cell. That was harmless with two switches; with the new step-5 switches (admitMode, intakePerSec, reserveDryRun, rejectionFence, readTimeoutMarginMs) it would flip a cell off reserve mode just by changing readiness.

  • Before: a write replaced the whole object. The read-back checked only readinessLocal and ticketCheck, and passed even when the cell's image did not know a switch the file named.
  • After: the workflow takes one set input (readinessLocal=true,admitMode=reserve; key=default removes a key). The tool reads the current object, changes only the named keys, and writes with the same compare-and-swap. The read-back compares every known switch at its effective value, and fails if the cell reports ignoredKeys, which means its image predates a switch the file names. Unknown switch names and out-of-range values are refused before anything is touched.

Keys the cell resolves for itself (intakePerSec is per region; readTimeoutMarginMs is the boot value) are compared only when the file names them, because the cell reports its own value for those.

Tooling only: no cell image change and no roll. Older images that do not report ignoredKeys read back exactly as before.

Why this approach

A read-modify-write keeps one source of truth, the stored object. The alternative, making the workflow list every switch, means every new switch is a new required input, and every run must restate values the operator did not mean to touch.

Testing

node --test cloud/dev/scripts/operate-relay-cell-flags.test.mjs: 13 pass. New tests cover keeping unnamed keys (unit and end to end), key=default removal, refusal of unknown or invalid switches, a read-back that fails when an unnamed key did not apply, cell-resolved keys, and ignoredKeys.

Director deploy guard

A director that predates the reserve census places hosts on a reserve cell from stale rows. Before moving traffic, the director deploy workflow now reads every cell's admit mode from both the serving and the candidate revision. If one revision lacks the census route (it 404s) and any cell is reserve, the deploy stops before the move: director revisions differ in reserve-mode support while cells are reserve (...); flip them to db first. Any other read failure also stops it. What it read is logged as director_reserve_support_checked. So a rollback to a pre-step-5 director needs every cell on db first, and every director must run step 5 before the first reserve flip.

…checks every key on read-back

A cell resets a key missing from its switch file to its default, so the tool now reads the
current object and changes only what --set names. The read-back compares every known key and
fails when the cell reports ignoredKeys.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 0f282624-687f-47aa-b938-f246577007dd








📥 Commits

Reviewing files that changed from the base of the PR and between e296c2d and b7e873d.









📒 Files selected for processing (3)
  • .github/workflows/cloud-operate-relay-production-cell-flags.yml
  • cloud/dev/scripts/operate-relay-cell-flags.mjs
  • cloud/dev/scripts/operate-relay-cell-flags.test.mjs








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










📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The workflow accepts comma-separated switch changes and passes them to the operations script. The script validates assignments against switch specifications and runtime support. It preserves unnamed values in the current cell switch object, writes the computed object, and checks the applied generation, ignored keys, and matching switch values. Admission-mode changes also update the director in a defined order. The break-glass path handles a standalone admitMode=default write and updates the director without cell read-back. Tests cover parsing, object updates, writes, admission-mode sequencing, break-glass behavior, and read-back.

































Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to b7e87

If the cell omits its effective admission mode, the director could enable database admission before control leases are reacquired. Resolve that uncertainty before merging.

Pre-merge checks | Passed 3 | Failed 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 56.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 2 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description explains the main change, rationale, and testing, but it omits several required template sections. It has no linked issue, ELI5 section, explicit What Changed section, Visual Proof or … Add the required template sections and complete them. Include an actual issue link after "Fixes #", write "N/A" with a reason for Visual Proof if applicable, document ELI5 and What Changed, complete AI Disclosure as applicable, address Revi…
✅ Passed checks (3 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 summarizes the primary change: the relay cell switch tool now changes only the named switches.







Full details: Docstring Coverage

Explanation

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








Full details: Description check

Explanation

The description explains the main change, rationale, and testing, but it omits several required template sections. It has no linked issue, ELI5 section, explicit What Changed section, Visual Proof or N/A statement, review notes, agent boundary checkbox, and completed checklist.

Resolution

Add the required template sections and complete them. Include an actual issue link after "Fixes #", write "N/A" with a reason for Visual Proof if applicable, document ELI5 and What Changed, complete AI Disclosure as applicable, address Review, Agent skill upstream boundary, Notes, and the Checklist.















✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
















  • 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.

…es not support

It reads supportedFlags from runtime-status (#27057). An image from before that field takes only
readinessLocal and ticketCheck off/shadow, so ticketCheck=enforce cannot void an old cell's object.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4bc8c0eb-c598-4baa-b822-42a49717008c
📥 Commits

Reviewing files that changed from the base of the PR and between acb9226 and 7cacaaa.

📒 Files selected for processing (2)
  • cloud/dev/scripts/operate-relay-cell-flags.mjs
  • cloud/dev/scripts/operate-relay-cell-flags.test.mjs

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

…d files, and records admitMode in Postgres

Every key and value of the object to be written is checked against what the image accepts (an
image without the list: only the keys it applies, ticketCheck off/shadow). A file the cell did
not apply is refused. admitMode=reserve needs a typed RESERVE <cell>; Postgres records reserve
before the file is written, and db only after the cell reports every control leased again.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8a31c330-35ae-4c0b-9e67-96e52af5fc53
📥 Commits

Reviewing files that changed from the base of the PR and between 7cacaaa and 30be9d3.

📒 Files selected for processing (3)
  • .github/workflows/cloud-operate-relay-production-cell-flags.yml
  • cloud/dev/scripts/operate-relay-cell-flags.mjs
  • cloud/dev/scripts/operate-relay-cell-flags.test.mjs

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

Comment on lines +299 to +309
const runtime = await readRuntime(fetchImpl, request, idToken, sleep).catch(() => null)
// An image without the field never admitted from memory.
if (runtime && (runtime.admitModeEffective ?? 'db') === 'db') return
await sleep(5_000)
}
log(JSON.stringify({ event: 'orca_relay_cell_reregistration_still_running', cellId: request.cellId }))
throw new Error(
`cell still re-registering after ${REREGISTER_WAIT_MS} ms; Postgres keeps reserve, so sweeps stay off. ` +
'Run again with the same --set once it reports db'
)
}

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '40,90p' cloud/dev/scripts/operate-relay-cell-flags.mjs
sed -n '285,390p' cloud/dev/scripts/operate-relay-cell-flags.mjs
sed -n '1,135p' cloud/apps/relay/src/cell-flags.ts

Repository: stablyai/orca

Length of output: 8426


Do not treat an omitted admitModeEffective as database admission.

When the cell accepts admitMode, waitForLeasedControls treats a missing runtime.admitModeEffective as db and records db with the director. A producer that omits this field can therefore re-enable sweeps before the cell reacquires its control leases.

Use an explicit admission value for images that support this transition. Keep the fallback only for legacy images that cannot accept admitMode, because assertSupportedObject rejects that transition before the director or cell write.

…es a refused write, and has a break-glass db flip

After recording reserve in Postgres it waits past every director's 5 s cache and records it
again (re-running the open-flow check) before writing the file. A file write refused outright
(412 or 4xx) puts Postgres back to db; after a 5xx it stays reserve. An object the cell did not
apply is repaired when the new object passes the image check. Break glass (typed BREAK GLASS
<cell>) records db for a dead or unreachable reserve cell without its read-back.
…glass only on a silent one, and undoes reserve if the second post is refused
…ls, and the deploy guard reads placement as built and refuses dropping a reserve cell from the shadow list
…ted deploy identity, and carry the shadow seat-feed cells

Staging passes --admin-audience for the reserve guard without durable rehome
verification, which the parser refused. Only the generation and control
origin now travel together, and they still need the audience.

The guard decodes the caller from its token and refuses, by name, a revision
whose ORCA_RELAY_DEPLOY_SERVICE_ACCOUNT is another account, instead of
reading into a 401.

--shadow-seat-feed-cells (preserve, all, or a cell list) is a workflow input
on both director deploys; preserve keeps the serving value. A contract test
parses every workflow's real argv for both deploy scripts.
…ll reports

An image from before the field falls back to the deployed sizes.
@Jinwoo-H
Jinwoo-H merged commit e9bf6d1 into main Oct 10, 2026
23 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.

1 participant