You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tests/hybrid_route.sh: the failing-provider arm flakes on CI (fixed ~10 s startup budget) #850
Summary.tests/hybrid_route.sh (ctest hybrid_route) fails intermittently on the CI runner, in the "failing provider"
arm, because the serve's startup budget is a fixed ~10 s and a loaded runner exceeds it.
Observed. Same commit, two CI runs 6 minutes apart on npu/... branch 1bit/qdq-q8-bench (e739699):
run 41509677141 success 19:24:43Z Test #20: hybrid_route ... Passed 6.66 sec
run 41510492737 failure 19:30:03Z Test #20: hybrid_route ... ***Failed 15.22 sec
FAIL serve starts with a failing provider
FAIL answers when the provider fails
FAIL not pinned when the provider failed
FAIL stderr: the failure named
and five further recent ci.yml runs pass it in 6.66-6.86 s (41513701150, 41512529034, 41510167311, 41508051556 and the
41509677141 above). Locally: six consecutive runs at load average 12.9-15.4 -> 6/6 pass, 6.68-6.88 s.
100 tries x (0.1 s sleep + one curl) is a ~10-15 s budget for a serve whose startup includes a warm-up request over the fake
backend (the passing arms log warm-up request /v1/chat/completions on port 33805 took 1001 ms). When the runner is slow
the loop exhausts, pid is still alive but the port never answered, and the arm's four checks cascade into failures.
Suggested fix. Raise the budget (200-300 tries, or a deadline in seconds rather than a count) and make the failure
say what it waited for: on exhaustion print the elapsed time, the last /health code, whether $pid is alive, and tail -5 "$log" — right now the only diagnostic is FAIL serve starts with a failing provider, and the logs are dumped
only if some check failed, which is why this looked like a routing defect at first.
That flake is currently able to redden any PR's build at random, which matters because the build check is a merge gate
in this repo.
Verified at origin/main906f966a2: tests/hybrid_route.sh:36 is exactly the loop reported (for _ in $(seq 1 100); do … sleep 0.1; done), inside start(), which every arm calls (:51, :72, :82) — so this is not a failing-provider-arm defect, it is the shared startup wait, and the arm that reddened is whichever one drew the slow runner.
Three details that shape the fix:
The budget is data-dependent, not 10 s. The sleep 0.1 is inside the loop, next to one curl per iteration, so the deadline is 100 × (0.1 s + curl) — 15.22 s in the failing run, 6.7 s in the passing ones. That is why the same commit passes and fails with no code change.
The failure is silent by construction.set -uo pipefail (:25, no -e), so when the loop exhausts, start() returns non-zero and the only output is the check's own name. The dump at :96 runs only after fail is already set and prints tail -20 of a log the serve had not written yet — i.e. the diagnostic we get is 20 lines of nothing.
A wall-clock deadline is the right shape, not a bigger count: the same number of tries is a different amount of real time on every runner.
I am taking this as my small fix (one file, no device, and it currently reddens the build check at random, which unblocks every other PR too): a seconds-based deadline plus one diagnostic line on exhaustion — elapsed, last /health code, whether $pid is alive, tail -5 "$log" — and a ~1 s fast path preserved on a quiet box. PR will reference this issue; the gate is the test itself under artificial load at the old budget and at the new one.
Correction to my own triage line above: at 906f966a2 the loop is at tests/hybrid_route.sh:45 (:44 is local code=000, :46 is the final [ "$code" = 200 ]), not :36 as I wrote — the file's 16-line license header and the start() prologue sit above it. The finding itself is unchanged.
Fix is up as PR #851 (one file, 14 insertions): deadline in seconds, fast path untouched, one diagnostic line on exhaustion. Before/after on the same stub — old loop FAIL serve starts with the fake provider after 11 s, new loop ok … at ~18 s, immediate-200 accepted in the same second.
Closed by merge 1347d4f0c (PR #851, merged 2026-11-02T23:50:41Z) — tests/hybrid_route.sh+14/−2, the only file.
What landed, and the check that the measurement still describes it: git show 1347d4f0:tests/hybrid_route.sh is byte-identical to the branch commit 20b9e3fc the before/after table in the PR body was measured on (diff → empty; bash -n clean). So the numbers are of the merged file, not of a sibling of it.
The change, in one line each:
before
after
for _ in $(seq 1 100); do … sleep 0.1; done — a try count, whose real budget was data-dependent: 100 × (0.1 s + one curl), i.e. 6.7 s quiet / 15.2 s loaded (:45)
a deadline in seconds ($((SECONDS + ${HYBRID_ROUTE_START_S:-60}))), the fast path unchanged (a serve that answers at once is accepted in the same second)
set -uo pipefail with no -e, so exhausting the loop was silent and the arm reported a routing failure
one diagnostic line on exhaustion: elapsed seconds, last /health code, whether the serve pid is alive, and tail -5 of the serve log
the end-of-run dump printed tail -20 of a log the serve never wrote, when startup was what failed
—
Measured (stub serve answering /health 503 for ~18 s, then 200; the stub answers no chat requests, so the later arms fail there by design and are not part of this change):
old loop, seq 1 100 FAIL "serve starts with the fake provider" after 11 s
new loop, same stub ok "serve starts with the fake provider", accepted at ~18 s
new loop, immediate 200 accepted in the same second (no latency added to the six passing arms)
new loop, never 200, 3 s one diagnostic line, then the check fails — instead of four cascading FAILs with no cause
No assertion was relaxed: the pass condition is still /health returning 200, so nothing that failed before can pass now. build on the PR was green (pr_agent, CodeQL, hw_gate skipped correctly) and has been green on main since the merge.
Activity
bong-water-water-bong commentedon Nov 2, 2026
Verified at
origin/main906f966a2:tests/hybrid_route.sh:36is exactly the loop reported (for _ in $(seq 1 100); do … sleep 0.1; done), insidestart(), which every arm calls (:51,:72,:82) — so this is not a failing-provider-arm defect, it is the shared startup wait, and the arm that reddened is whichever one drew the slow runner.Three details that shape the fix:
sleep 0.1is inside the loop, next to onecurlper iteration, so the deadline is100 × (0.1 s + curl)— 15.22 s in the failing run, 6.7 s in the passing ones. That is why the same commit passes and fails with no code change.set -uo pipefail(:25, no-e), so when the loop exhausts,start()returns non-zero and the only output is the check's own name. The dump at:96runs only afterfailis already set and printstail -20of a log the serve had not written yet — i.e. the diagnostic we get is 20 lines of nothing.I am taking this as my small fix (one file, no device, and it currently reddens the
buildcheck at random, which unblocks every other PR too): a seconds-based deadline plus one diagnostic line on exhaustion — elapsed, last/healthcode, whether$pidis alive,tail -5 "$log"— and a ~1 s fast path preserved on a quiet box. PR will reference this issue; the gate is the test itself under artificial load at the old budget and at the new one.bong-water-water-bong commentedon Nov 2, 2026
Correction to my own triage line above: at
906f966a2the loop is attests/hybrid_route.sh:45(:44islocal code=000,:46is the final[ "$code" = 200 ]), not:36as I wrote — the file's 16-line license header and thestart()prologue sit above it. The finding itself is unchanged.Fix is up as PR #851 (one file, 14 insertions): deadline in seconds, fast path untouched, one diagnostic line on exhaustion. Before/after on the same stub — old loop
FAIL serve starts with the fake providerafter 11 s, new loopok …at ~18 s, immediate-200 accepted in the same second.tests: hybrid_route waits on a deadline, not a try count (engine #850) (
bong-water-water-bong commentedon Nov 3, 2026
Closed by merge
1347d4f0c(PR #851, merged 2026-11-02T23:50:41Z) —tests/hybrid_route.sh+14/−2, the only file.What landed, and the check that the measurement still describes it:
git show 1347d4f0:tests/hybrid_route.shis byte-identical to the branch commit20b9e3fcthe before/after table in the PR body was measured on (diff→ empty;bash -nclean). So the numbers are of the merged file, not of a sibling of it.The change, in one line each:
for _ in $(seq 1 100); do … sleep 0.1; done— a try count, whose real budget was data-dependent: 100 × (0.1 s + onecurl), i.e. 6.7 s quiet / 15.2 s loaded (:45)$((SECONDS + ${HYBRID_ROUTE_START_S:-60}))), the fast path unchanged (a serve that answers at once is accepted in the same second)set -uo pipefailwith no-e, so exhausting the loop was silent and the arm reported a routing failure/healthcode, whether the serve pid is alive, andtail -5of the serve logtail -20of a log the serve never wrote, when startup was what failedMeasured (stub serve answering
/health503 for ~18 s, then 200; the stub answers no chat requests, so the later arms fail there by design and are not part of this change):No assertion was relaxed: the pass condition is still
/healthreturning 200, so nothing that failed before can pass now.buildon the PR was green (pr_agent, CodeQL,hw_gateskipped correctly) and has been green onmainsince the merge.