Repository navigation
fix(relay): the cell switch tool changes only the named switches - #27056
Conversation
…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.
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to 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 |
|
…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.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4bc8c0eb-c598-4baa-b822-42a49717008c
📒 Files selected for processing (2)
cloud/dev/scripts/operate-relay-cell-flags.mjscloud/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.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8a31c330-35ae-4c0b-9e67-96e52af5fc53
📒 Files selected for processing (3)
.github/workflows/cloud-operate-relay-production-cell-flags.ymlcloud/dev/scripts/operate-relay-cell-flags.mjscloud/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.
| 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' | ||
| ) | ||
| } |
There was a problem hiding this comment.
🗄️ 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.tsRepository: 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.
…ode support while any cell is reserve
…ce, and says how to finish
…glass only on a silent one, and undoes reserve if the second post is refused
…ng it off while any cell is reserve
…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.
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-localandticket-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.readinessLocalandticketCheck, and passed even when the cell's image did not know a switch the file named.setinput (readinessLocal=true,admitMode=reserve;key=defaultremoves 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 reportsignoredKeys, 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 (
intakePerSecis per region;readTimeoutMarginMsis 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
ignoredKeysread 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=defaultremoval, refusal of unknown or invalid switches, a read-back that fails when an unnamed key did not apply, cell-resolved keys, andignoredKeys.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 asdirector_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.