Skip to content

test(relay): load generator can reopen a closed phone splice instead of failing the run - #27379

Merged
Jinwoo-H merged 3 commits into
mainfrom
relay-load-splice-retry
Oct 11, 2026
Merged

Jinwoo-H merged 3 commits into
mainfrom
relay-load-splice-retry

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​119 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​119
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​96 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​89

ELI5

The relay load generator stops the whole run if a single simulated phone connection ("splice") closes. Real phones reconnect. This adds an opt-in flag so a closed splice reopens after a short random wait, the way the app retries, and the report counts those closes and how long each one took to come back.

What Changed

  • New --splice-retry-max-seconds N (default 0). With 0 nothing changes: the first splice failure fails the run, as today, so existing proof profiles behave the same. With N > 0, a splice that closes or fails to open (a close code, an HTTP 429/503 on upgrade, or no active control because the control is reconnecting) retries after a random 0–N s wait until the run stops.
  • The report adds spliceRetries, spliceFailuresByReason (closed_<code>, http_<status>, no_active_control, other), and spliceReopen (reopened, still awaiting, p50/p95/max reopen time).
  • New relay-load-splice-retry.mjs plus its test, added to the cloud test list.

Why

In the step-5 staging run, two base loads died at 02:48Z and 03:10Z: one splice got a 429 from a cell's per-source pre-auth limit, and another closed 1006. Both took down 600 controls with them. The e2e also needs phones held open across a cell's reserve/db flips, and that needs splices that reconnect. Leaving the default at 0 means no existing workflow or proof changes behaviour unless it passes the flag.

Linked Issue

N/A (maintainer; step-5 staging e2e follow-up).

Visual Proof

N/A: load-harness only.

Testing

  • relay-load-splice-retry (new; 5 tests), relay-load-profile, relay-load-run-lifecycle and relay-load-control-peer: 58/58 pass.
  • node --check load-relay-controls.mjs.

Second change: reconnect flag. After a control has been established once, the simulated host now sends reconnect: true when it asks for a new assignment. Real desktops already do this (relay-origin-pool.ts, relay-session-broker.ts). Without the flag the director never takes its sticky lane, so a cell restart under load could not test sticky re-booking (runbook §7 step 4 always read stickyReserves 0). A new peer test checks the flag is absent on the first assignment and present after a control is established.

Third change: silence limit. A simulated host now closes its control after 75 s with no inbound frame. Desktops do the same (relay-control-liveness.ts), and the cell pings every 15 s. When a cell's VM is deleted, the load balancer keeps the client websocket open (backend timeout 86400 s). Without this check, a stopped cell's simulated hosts never noticed and never re-assigned (runbook §8a). A new peer test uses fake timers.

…of failing the run (--splice-retry-max-seconds)
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: b75f7054-d48e-4ad7-87f7-a381b5664096


📥 Commits

Reviewing files that changed from the base of the PR and between 615e218 and b179271.



📒 Files selected for processing (2)
  • cloud/dev/scripts/relay-load-control-peer.mjs
  • cloud/dev/scripts/relay-load-control-peer.test.mjs


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




📝 Walkthrough
📝 Walkthrough

Walkthrough

The relay load script now accepts a configurable splice retry limit. It tracks retry failures by reason and records elapsed times when failed splices reopen. Reports include retry counts and reopen summaries. The relay control peer monitors socket activity and terminates a silent control socket after more than 75 seconds. Director assignment requests include reconnect: true when a control generation exists.



Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to b1792

The retry option may delay shutdown, or keep retrying past the intended duration when splices fail persistently. This only affects the opt-in load tool, but it should be resolved or explicitly accepted before merge.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning 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 6 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 describes the primary change: the relay load generator can reopen a closed phone splice instead of failing the run.
Description check Passed The description is mostly complete. It explains the user-facing behavior, implementation, rationale, linked-issue exception, visual-proof status, and testing results. The Review, Agent skill upstream …

  • Fix all pre-merge checks with AI
✨ 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.

@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: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 83a8c2ae-766d-49d6-a8b6-c5ac2c7f9e66
📥 Commits

Reviewing files that changed from the base of the PR and between dae2cc9 and c065855.

📒 Files selected for processing (5)
  • cloud/dev/scripts/load-relay-controls.mjs
  • cloud/dev/scripts/relay-load-profile.mjs
  • cloud/dev/scripts/relay-load-splice-retry.mjs
  • cloud/dev/scripts/relay-load-splice-retry.test.mjs
  • cloud/package.json

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

holdMs: config.spliceHoldMs
}),
retryMaxMs: config.spliceRetryMaxMs,
stopping: () => state.stopping,

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.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Check whether the duration deadline changes state.stopping before Promise.all waits for retries.
rg -n -C 3 'state\.stopping\s*=|Promise\.all\(|splicePromises|durationMs' cloud/dev/scripts/load-relay-controls.mjs
sed -n '560,635p' cloud/dev/scripts/load-relay-controls.mjs

Repository: stablyai/orca

Length of output: 4822


🏁 Script executed:

set -e
printf '%s\n' '--- imports and references ---'
rg -n -F --glob '*.mjs' -- 'runRelayLoadWithShutdown' cloud/dev
printf '%s\n' '--- declarations ---'
rg -n -F --glob '*.{mjs,js,ts}' -- 'function runRelayLoadWithShutdown' cloud dev
printf '%s\n' '--- candidate definitions ---'
rg -l -F --glob '*.{mjs,js,ts}' -- 'runRelayLoadWithShutdown' cloud dev | while read -r f; do
  printf '\n--- %s ---\n' "$f"
  rg -n -C 12 -F -- 'runRelayLoadWithShutdown' "$f"
done

Repository: stablyai/orca

Length of output: 818


🏁 Script executed:

set -e
printf '%s\n' '--- cloud/dev/scripts/relay-load-run-lifecycle.mjs ---'
nl -ba cloud/dev/scripts/relay-load-run-lifecycle.mjs | sed -n '1,180p'
printf '%s\n' '--- cloud/dev/scripts/relay-load-run-lifecycle.test.mjs ---'
nl -ba cloud/dev/scripts/relay-load-run-lifecycle.test.mjs | sed -n '1,180p'

Repository: stablyai/orca

Length of output: 3558


🏁 Script executed:

set -e
printf '%s\n' '--- holdRelayLoadSplice references ---'
rg -n -F --glob '*.mjs' -- 'holdRelayLoadSplice' cloud/dev
printf '%s\n' '--- helper definition context ---'
file=$(rg -l -F --glob '*.mjs' -- 'export async function holdRelayLoadSplice' cloud/dev | head -n 1)
test -n "$file"
printf 'FILE=%s\n' "$file"
nl -ba "$file" | sed -n '1,220p'

Repository: stablyai/orca

Length of output: 2732


Signal the run deadline independently of splice completion.

runRelayLoadWithShutdown invokes shutdown only after the operation resolves. A continuously failing splice therefore keeps retrying after config.durationMs, because state.stopping remains false. Set state.stopping from the duration timer.

🐛 Suggested fix
-  await Promise.all([...splicePromises, delay(config.durationMs)])
+  const duration = delay(config.durationMs).then(() => {
+    state.stopping = true
+  })
+  await Promise.all([...splicePromises, duration])

} catch (error) {
if (stopping()) return undefined
onFailure(relayLoadSpliceFailureReason(error))
await delay(Math.ceil(random() * retryMaxMs))

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.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Make the retry delay interruptible.

If stopping() becomes true during delay(), the splice promise remains pending until the full wait ends. With --splice-retry-max-seconds 300, shutdown can wait almost five additional minutes. Cancel the pending delay when the run stops, and test a stop that occurs during the delay.

… desktops do

Without it the director's sticky lane is never reached, so a cell restart under load
cannot exercise the sticky re-booking.
The load balancer keeps a dead backend's client websocket open, so a stopped cell's
simulated hosts never noticed and never re-assigned.
@Jinwoo-H
Jinwoo-H merged commit 29b0aa5 into main Oct 11, 2026
22 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