Repository navigation
fix(relay-ops): bind the canary cell's admission class into same-cap batch authority - #21313
Conversation
…batch authority A batch-apply wave verified only that the sealed canary named some approved same-cap cell, so a canary rolled on the migration-only, zero-host, 600-cap c17 or c18 was accepted as authority for a general 1000/3000-cap batch. The verify step now hands the batch's own cells to the check, which requires the sealed cell's entry admission to equal the batch's class.
|
This run was cancelled 🛑 The workflow was cancelled before completion. Please check the link below for details. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change adds admission-class validation to same-cap canary authority checks. The validator derives the batch class from its cell IDs and rejects a canary authority from a different class. The Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The admission-class check rejects mixed batches and cross-class canary reuse, with workflow wiring and tests covering the intended path. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (1 skipped: 1 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 |
…batch authority (stablyai#21313) A batch-apply wave verified only that the sealed canary named some approved same-cap cell, so a canary rolled on the migration-only, zero-host, 600-cap c17 or c18 was accepted as authority for a general 1000/3000-cap batch. The verify step now hands the batch's own cells to the check, which requires the sealed cell's entry admission to equal the batch's class.

ELI5
We roll a new Relay image one machine at a time. The first machine is a test run, and if it goes well we reuse that success as permission to roll a small batch of the others.
Two of the approved machines, c17 and c18, are special: they hold no users at all and are sized much smaller. A successful test run on one of those proves almost nothing about the busy machines. Until now the permission check did not look at which machine the test run happened on, so a test on an empty machine could unlock a batch of busy ones. This makes the check insist that the test run and the batch are the same kind of machine.
What Changed
Before: a
batch-applywave downloaded the sealed canary artifact and verified the run ID, both image digests, the rehome generation, the selector generation, the provenance of the code that sealed it, and that the sealed cell was somewhere in the approved same-cap list. It never compared the sealed cell to the cells being rolled. An operator could seal a canary onproduction-gce-c17(migration-only, zero hosts, 600 connection cap, rehome protocol 0) at selector generation 234 and reuse it to authorize ac7,c8batch (general, 1000 and 3000 caps, rehome protocol 3) at the same generation. Both steps would report success and production would roll on evidence that never covered it.After: the gate's verify step passes the batch's own cell list to the check, and the check requires
entryAdmission(<sealed canary cell>)to equal the batch's admission class. A crossed pair fails before any mutation with a message naming both classes, for examplecanary authority cell production-gce-c17 is migration-only, but this batch is general. Matching pairs in either direction still pass, soc17still authorizes ac17,c18batch andc7still authorizesc8,c9.Mechanism, in three parts:
verifyCanaryAuthoritynow derives the batch's class from the batch cells it is given. Those cells run through the same validator the gate already uses, which rejects unknown cells and mixed-class waves, so the first cell names the whole batch's class.same-cap wave cells are invalidrather than an unverified class, so the safety check cannot be skipped by forgetting an argument.--cell-ids, and its remaining digest and generation arguments moved from inline template expressions intoenv:entries, matching the surrounding steps and letting a test run the step's shell verbatim.The sealed artifact format is unchanged, so canaries sealed by earlier runs still verify.
This was never reachable from a single-cell
canary-applywave, because the verify path only runs underbatch-apply. It is closed before the next batch.Why
The admission class is the one property of a same-cap cell that changes what a successful roll proves. A migration-only cell holds no hosts, sits at a different connection cap, is outside the rehome source list so it rolls at protocol 0, and its isolate and restore are both no-ops, so its wave advances no selector at all. None of that exercises what a general cell's roll exercises.
Two alternatives were considered and rejected:
c17thenc17,c18sequence, which is exactly the pattern those two cells exist for.Follow-up, deliberately not in this PR: the authority still does not bind the rehome protocol a canary rolled at. Binding it needs a new sealed field and therefore a format change and a compatibility window, so it belongs in its own change.
Linked Issue
Follows up on the review of #21307. No separate issue was filed.
Fixes #
Visual Proof
N/A. This is a deploy-workflow gate with no user interface; the only observable output is the error text quoted above, which is asserted in the tests.
Testing
macOS, Node 24. Cross-platform, SSH/remote, and mobile are not affected: the change is a GitHub Actions gate script that runs only on the Linux runner.
Two new tests, both confirmed to fail without the fix:
refuses a canary sealed on a cell of the other admission classcovers both crossed directions, both matching directions, and the missing-batch fail-closed case. Reverting only the class check turns it red.the batch gate hands its own cells to the canary checkextracts the dispatch workflow's verify step verbatim and runs it underbash -euo pipefailagainst a real sealed artifact, the same way feat(relay-ops): allow the migration-only cells c17 and c18 in same-cap waves #21307's tests run the job's shell blocks. Removing only the--cell-idsline from the workflow turns it red, so the wiring is load-bearing and cannot silently rot.Existing tests were updated to name the batch they verify against, which is the new required argument. One existing assertion changed meaning: the migration-only seal test previously asserted that a
c17canary authorizes a later general batch, which is the defect itself. It now asserts that the same canary authorizes a later migration-only batch, and the generation assertions it exists for are untouched.Commands run:
The single failure is
relay-load-control-peer.test.mjs, which cannot resolvetweetnaclin an uninstalled worktree. It is environmental and unrelated; it does not import anything this PR touches.actionlinton the changed workflow reports only the three pre-existingrunner-labelfindings for the customblacksmith-2vcpu-ubuntu-2204runner, identical in count and location to the file atorigin/main. With those ignored it is clean.Typecheck was not run against these files because it cannot reach them: the diff has no TypeScript,
cloud/dev/scriptsis outside everytsconfig, andallowJsandcheckJsare off throughoutcloud/.AI Disclosure
Review
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: this tightens an authorization check on a production mutation path and loosens nothing. The moved template expressions also remove five inline interpolations from a shell script, which is the safer shape for operator-supplied input.
Backwards compatibility: the artifact format is unchanged, so canaries sealed by runs already in flight still verify. The only behavior change for an operator is that a batch whose canary came from the other class now fails at the gate instead of rolling.
Performance, cross-platform, SSH/remote, mobile: not applicable.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)