Repository navigation
fix(relay): drain a same-cap cell over 5 minutes, not 2 - #22584
Conversation
The 2026-09-23 c27 roll drained 2,145 hosts over the 2-minute window, about 18 re-dials/s, while the director re-places roughly 8/s through its single-slot sticky lane. The overflow queued behind slow re-placements and timed out, so /v1/assign returned 503 fleet-wide for about 5 minutes. 5 minutes is the cell's maximum pace window and keeps the remaining 2,650-host cells near lane capacity. The transition wait already outlasts a 5-minute window (17 min). Claude-Session: ced32ebb-7155-4413-adad-1eccd14c2010
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe production relay rollout workflow retains Priority: ➖ Normal Merge Risk: 🔵 Low · up to The rollout timing is configured as intended, but its test could miss a future timeout regression. This is a bounded test gap rather than a current rollout failure. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the change, user impact, mechanism, alternatives, and testing. However, it omits required template content, including the Linked Issue with a Resolution Add the missing required template sections. Include the issue reference under Linked Issue, write
✨ Finishing Touches📝 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: 81a07310-6587-4c3c-9fe0-e70b4a5690d0
📒 Files selected for processing (1)
.github/workflows/cloud-deploy-relay-production-same-cap-job.yml
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
There was a problem hiding this comment.
Important
Changing DRAIN_PACE_WINDOW_MS leaves the census test that pins it at '120000', so cloud's pnpm test fails. One-line test update needed before merge.
Reviewed changes
- Drain pace widened to 5 minutes — the reusable same-cap job's
DRAIN_PACE_WINDOW_MSgoes'120000'→'300000', and the comment above it is rewritten to explain the director's ~8 hosts/s sticky-lane ceiling and the 2026-09-23 assign brownout.
The mechanism is sound: 300000 sits exactly on the cell's inclusive cap (DRAIN_PACE_WINDOW_MAX_MS = 5*60*1000, cloud/apps/relay/src/app.ts:63,502) and the script validator's MAX_PACE_WINDOW_MS (cloud/dev/scripts/prepare-relay-production-capacity-canary.mjs:39,76), and the following transition wait --timeout-ms 1020000 still outlasts the longer window. The one blocker is the un-updated pin, reported inline.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Claude-Session: ced32ebb-7155-4413-adad-1eccd14c2010
The transition wait after a drain was set to the 15-minute migration lease plus the pace window. Widening the window to 5 minutes without moving the wait left 12 minutes for a migration that can hold for 15, so a late-window migration would time the wave out into rollback. Claude-Session: ced32ebb-7155-4413-adad-1eccd14c2010
|
Review round 1 addressed: the same-cap contract test now pins the 5-minute window; the post-drain transition wait moves from 17 to 20 minutes so it stays at the 15-minute migration lease plus the window; the header comment no longer claims a 2,700-host cell sits within capacity. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes (since the prior pullfrog review at 0f8bba3)
- Census pin updated —
cloud/dev/scripts/relay-same-cap-script-census.test.mjsnow pinsDRAIN_PACE_WINDOW_MS: '300000'instead of'120000', clearing the failing assertion the prior review blocked on. Verified locally:node --test cloud/dev/scripts/relay-same-cap-script-census.test.mjspasses 25/25. - Transition wait raised to 20 minutes —
--timeout-msgoes1020000→1200000, i.e. the 15-min migration lease plus the 5-min window. The paced drain returns immediately and spreads sends over the window, so the verify budget does need to cover both; the census assertion follows the new literal. - Env comment rewritten — the drain comment now states the 15-min lease plus window arithmetic instead of the old "well under the director's cap" claim.
The delta is workflow/test-only and mechanically consistent: the window sits exactly on the cell's inclusive cap, and the wait literal matches the lease-plus-window sum.
ℹ️ Nitpicks
- The PR body's "Mechanism" section still says the wait "already allows 17 minutes"; the new commit raises it to 20 minutes, so that sentence is now stale.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
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: 8d4c974a-827e-4baf-b2be-e056e65cc4cd
📒 Files selected for processing (2)
.github/workflows/cloud-deploy-relay-production-same-cap-job.ymlcloud/dev/scripts/relay-same-cap-script-census.test.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/cloud-deploy-relay-production-same-cap-job.yml
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| assert.match(workflow, /DRAIN_PACE_WINDOW_MS: '300000'/) | ||
| // The transition wait has to outlast the pacing window on top of the leases it waits on. | ||
| assert.match(workflow, /--activity restart-safe[\s\S]*?--timeout-ms 1020000/) | ||
| assert.match(workflow, /--activity restart-safe[\s\S]*?--timeout-ms 1200000/) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 12 -- '--activity restart-safe|--timeout-ms' .github/workflows/cloud-deploy-relay-production-same-cap-job.ymlRepository: stablyai/orca
Length of output: 3391
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '300,325p' cloud/dev/scripts/relay-same-cap-script-census.test.mjs
sed -n '568,586p' .github/workflows/cloud-deploy-relay-production-same-cap-job.yml
sed -n '738,752p' .github/workflows/cloud-deploy-relay-production-same-cap-job.ymlRepository: stablyai/orca
Length of output: 3685
Bind the timeout assertion to the restart-safe command.
The current regex can cross command boundaries. Match only continued option lines for this command so a later timeout cannot satisfy the assertion.
Suggested fix
- assert.match(workflow, /--activity restart-safe[\s\S]*?--timeout-ms 1200000/)
+ assert.match(workflow, /--activity restart-safe[^\n]*\\\n(?:[ \t]+--[^\n]*\\\n)*[ \t]+--timeout-ms 1200000/)📝 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.
| assert.match(workflow, /--activity restart-safe[\s\S]*?--timeout-ms 1200000/) | |
| assert.match(workflow, /--activity restart-safe[^\n]*\\\n(?:[ \t]+--[^\n]*\\\n)*[ \t]+--timeout-ms 1200000/) |

What changed
The same-cap relay cell rollout now spreads a cell's drain over 5 minutes instead of 2. One environment value in the reusable job plus its comment. No application code changes.
Before and after, as the user sees it
Before: when a large relay cell (about 2,000 hosts) was rolled, every desktop connected to it re-dialed the director within 2 minutes. The director serialises those re-placements and could only clear about 8 per second, so for about 5 minutes any Orca host anywhere trying to connect or reconnect got "try again in 2 seconds" repeatedly. Existing sessions were unaffected. Measured on 2026-09-23 during the c27 roll: about 22,000 rejected assign calls, 3% success at the worst minute.
After: the same drain takes 5 minutes, about 6 to 9 re-dials per second for the remaining cells, near or under what the director clears. Expected result is a short tail of slower reconnects rather than a multi-minute fleet-wide brownout. This is a mitigation for planned rolls only; the director-side fix that also covers crashes and mass restarts is tracked separately.
Mechanism
The cell's drain endpoint already spreads its drain sends evenly across a caller-supplied window, capped at 5 minutes. The workflow asked for 2 minutes based on a comment that mistook the Cloud Run request-concurrency setting for the director's assign capacity. The wait step that follows the drain already allows 17 minutes, so it outlasts the longer window.
Alternatives considered
Testing
Workflow-only change. Verified the cell accepts a 300000 ms window (inclusive maximum), the drain script's validation allows it, and the transition wait exceeds it. Will be exercised by the next same-cap roll (c30 first, the smallest remaining cell).