Repository navigation
fix(relay-ops): accept a drained predecessor on a cell that holds no hosts - #21315
Conversation
…hosts c17's canary stopped at the pre-apply predecessor check with `runtime predecessor mismatch fields=draining`. The flag is residue: the previous canary (run 35290908836) drained c17 at 00:26:01, its terraform apply then failed, and the failsafe re-isolates without restarting the VM, so nothing cleared it. The same run had passed this very check a second earlier, which is what proves a parked cell is not draining at rest. Draining means connections are being shed, and a migration-only cell holds none, so the flag is not a precondition there. Accept it on entry for that class only. The replacement VM is still required not to be draining, on every path, and the incarnation check still proves it was replaced. Both predecessor checks now read one decision instead of computing the rule twice, so the assertion and its diagnostic cannot disagree. Every general-cell and rollback path keeps the value it had; a census test runs the real block over all eight mode and class combinations to hold that.
|
This run was cancelled 🛑 The workflow was cancelled before completion. Please check the link below for details. |
📝 WalkthroughWalkthroughThe production same-cap workflow now allows Priority: ➖ Normal Merge Risk: 🔵 Low · up to Clarify the rollback exception so operators do not reject a supported failed-canary recovery state. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description is detailed and covers the change, rationale, testing, risks, and checklist. However, the required Linked Issue field is marked N/A instead of identifying one issue with the required linkage format. Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
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: 9549d60a-78ed-4fe9-9f00-11f01d360b8a
📒 Files selected for processing (3)
.github/workflows/cloud-deploy-relay-production-same-cap-job.ymlcloud/dev/scripts/relay-same-cap-script-census.test.mjscloud/docs/relay-workflows.md
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| A drained cell is refused before a roll, because draining means something is already | ||
| shedding its connections. A migration-only cell has none to shed, so the flag decides nothing | ||
| there and is accepted on entry; the replacement VM is still required not to be draining, and | ||
| the incarnation check still proves it was replaced. That also unwedges the state a failed | ||
| canary leaves behind, where the wave's own drain set the flag and no restart followed. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '360,475p' .github/workflows/cloud-deploy-relay-production-same-cap-job.yml
sed -n '385,410p' cloud/docs/relay-workflows.md
sed -n '515,590p' cloud/dev/scripts/relay-same-cap-script-census.test.mjsRepository: stablyai/orca
Length of output: 12487
Document the predecessor-draining rule for rollback.
The workflow accepts a drained predecessor for non-resume rollback, regardless of entry class. It rejects a drained predecessor for rollback-resume, and for apply or verify when the entry class is general. The failed-canary sentence hints at the non-resume case, but it does not name the rollback exception and conflicts with the absolute “before a roll” statement.
Proposed documentation change
-A drained cell is refused before a roll, because draining means something is already
-shedding its connections. A migration-only cell has none to shed, so the flag decides nothing
-there and is accepted on entry; the replacement VM is still required not to be draining, and
-the incarnation check still proves it was replaced. That also unwedges the state a failed
-canary leaves behind, where the wave's own drain set the flag and no restart followed.
+For `apply` and `verify`, a drained general cell is refused before a roll because
+draining means it is already shedding connections. A migration-only cell has none to shed,
+so it is accepted on entry. A non-resume `rollback` accepts a drained predecessor for either
+entry class, including the state a failed canary can leave behind. A rollback-resume requires
+the predecessor not to be draining. The replacement VM is still required not to be draining,
+and the incarnation check still proves replacement after a restart.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| A drained cell is refused before a roll, because draining means something is already | |
| shedding its connections. A migration-only cell has none to shed, so the flag decides nothing | |
| there and is accepted on entry; the replacement VM is still required not to be draining, and | |
| the incarnation check still proves it was replaced. That also unwedges the state a failed | |
| canary leaves behind, where the wave's own drain set the flag and no restart followed. | |
| For `apply` and `verify`, a drained general cell is refused before a roll because | |
| draining means it is already shedding connections. A migration-only cell has none to shed, | |
| so it is accepted on entry. A non-resume `rollback` accepts a drained predecessor for either | |
| entry class, including the state a failed canary can leave behind. A rollback-resume requires | |
| the predecessor not to be draining. The replacement VM is still required not to be draining, | |
| and the incarnation check still proves replacement after a restart. |
…hosts (stablyai#21315) c17's canary stopped at the pre-apply predecessor check with `runtime predecessor mismatch fields=draining`. The flag is residue: the previous canary (run 35290908836) drained c17 at 00:26:01, its terraform apply then failed, and the failsafe re-isolates without restarting the VM, so nothing cleared it. The same run had passed this very check a second earlier, which is what proves a parked cell is not draining at rest. Draining means connections are being shed, and a migration-only cell holds none, so the flag is not a precondition there. Accept it on entry for that class only. The replacement VM is still required not to be draining, on every path, and the incarnation check still proves it was replaced. Both predecessor checks now read one decision instead of computing the rule twice, so the assertion and its diagnostic cannot disagree. Every general-cell and rollback path keeps the value it had; a census test runs the real block over all eight mode and class combinations to hold that.

ELI5
Before a cell is upgraded, the rollout checks it is not already "draining", which
means something is shedding its connections. c17 was flagged as draining, so the
check refused.
It was draining because the previous attempt drained it and then failed before
replacing the machine, so the flag was left behind. And c17 has no connections at
all, so draining it never meant anything in the first place.
What Changed
Before. Canary-apply on c17 (run 35292335415) failed at Verify exact current
generation, digest, cap, and rollback point with
runtime predecessor mismatch fields=draining. Nothing was applied.After. A cell whose entry class is migration-only is allowed to be draining on
entry. General cells are unaffected.
The flag is residue, not a property of a parked cell. The previous canary,
run 35290908836, passed this exact check at 00:25:59 and then drained c17 one
second later:
Its terraform apply then failed, and the failsafe re-isolates without restarting
the VM, so nothing cleared the flag. c17 is sitting in the state its own
interrupted wave left it in.
The fix. Draining means connections are being shed. A migration-only cell
holds none, so the flag carries no precondition there.
PRECHECK_DRAININGbecomeseitherand the runtime assertion'sdrainingOkbecomes true for that classonly. Both predecessor checks now read one
PREDECESSOR_DRAINING_OKdecisionrather than recomputing the rule, so the assertion and its diagnostic cannot
disagree.
What still holds on every path: the replacement VM must report
drainingfalseafter the apply and again after the restore, and the incarnation must change,
which is what proves the VM was actually replaced.
Why
I want to flag that the brief's premise was not what the evidence showed. The
proposal was that a parked cell is drained by design. It is not: c17 passed this
same check a second before its own drain ran. Accepting draining because "parked
means drained" would have written a false invariant into the workflow and blinded
the check permanently.
The reason that survives the evidence is different and narrower: a cell with no
hosts has nothing to shed, so the flag is not a precondition for it. That happens
to unwedge the same state, and it is true independently of how c17 got here.
The alternative was to clear the residue instead of accepting it, by rolling c17's
VM out of band or via
rollbackmode. Out of band means an unreviewed productionmutation outside the wave.
rollbackdoes not work here either, and that is worthrecording: c17 still serves the rollback image, so
ROLLBACK_RESUMEis true, andthe resume path both requires a non-draining predecessor and never restarts the
VM, so it could not clear the flag even if it were let through.
A wider gap I did not fix. The same wedge exists for a general cell whose
apply fails between the drain and the terraform apply. It ends up migration-only
and draining on the rollback image; apply refuses the admission class, and
rollback classifies it as a resume and refuses the draining. Nothing in this PR
changes that, and it needs its own decision about whether
ROLLBACK_RESUMEshouldbe distinguishable from a wave that stopped before its template apply. Raising it
rather than widening this change.
On the pool question.
EXPECTED_DATABASE_POOL_MAXbeing empty is correct forc17 and c18, and no change is needed. In
variables.tfa cell'sregiondefaultsto
us-central1anddatabase_pool_maxto10; c17 and c18 set neither, soinclude_database_pool_maxis false and their template emits no pool line. Thecaptured template from the run confirms it: no
ORCA_RELAY_DATABASE_POOL_MAXandno
ORCA_RELAY_CELL_REGION. The pool-16 pin is Asia-only, as suspected. This isalready held by a test: the census asserts every approved cell's resolved pool
equals what
production.tfvarscarries.Linked Issue
N/A - operational follow-up to #21307 and #21314.
Visual Proof
N/A. No UI. This changes a GitHub Actions rollout workflow.
Testing
All from
cloud/.pnpm test— 622 pass, 0 fail in the dev-script suite; 156 pass, 0 fail inpretest; relay-ops 134, relay 717 passed / 121 skipped, push 139 passed / 4skipped, postgres-schema 108, relay-contract 35, push-contract 30,
relay-fence-broker 16. No failures.
pnpm typecheck,pnpm lint,pnpm build— clean.actionlint— clean apart from the pre-existing unknown blacksmith runner label.The new census test extracts the real decision block from the workflow and runs it
under
bashfor all eight combinations of mode and entry class. Every general-celland rollback row asserts the value the old expression produced, which is what holds
those paths unchanged:
Only the two migration-only apply and verify rows differ from main.
A second test asserts both predecessor checks read the single decision, that the
old inline expression is gone, and that the post-apply and post-restore steps still
require the fresh VM not to be draining.
Not verified: c17's live
drainingvalue right now. The diagnosis rests on the tworun logs, which show the check passing at 00:25:59, the drain at 00:26:01, and the
failure at 00:46:21.
AI Disclosure
Review
Please look at the Why section rather than the diff. The brief asked for this
change on a premise the logs contradict, and I implemented the mechanism with a
different justification. If you disagree that "a cell with no hosts has nothing to
shed" is enough to drop the precondition, the alternative is clearing the residue
by replacing c17's VM, and this PR should be closed.
The same-cap job workflow is in
TRUSTED_EVIDENCE_CODE_PATHS, so merginginvalidates any canary authority sealed before it.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Security: the relaxation is scoped to cells the selector holds in migration-only,
which take no new hosts. Every end-state check is unchanged, including the two that
require the replacement VM not to be draining and the one that requires a new
incarnation.
Backwards compatibility: every general-cell and rollback path keeps the value it
had, held by the table above.
Cross-platform, SSH, mobile, performance: N/A. CI-only.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)