Repository navigation
tests: hybrid_route waits on a deadline, not a try count (engine #850) - #851
Conversation
The failing-provider arm reddened the CI `build` check at random: `start()`'s startup wait was `seq 1 100` with `sleep 0.1` inside the loop, so its real budget was data-dependent (6.7 s on a quiet box, 15.2 s on a loaded runner) and every arm that used it could fail as if routing had broken. Now: a deadline in seconds (60 s default, `HYBRID_ROUTE_START_S` for tests), the fast path unchanged (a serve that answers at once is accepted in the same second), and one diagnostic line on exhaustion with elapsed time, the last `/health` code, whether the serve is alive, and the tail of its log. Measured with a stub serve answering `/health` 503 for ~18 s then 200: old loop -> "FAIL serve starts with the fake provider" after 11 s (100 tries exhausted) new loop -> "ok serve starts with the fake provider", accepted at ~18 s new loop, immediate 200 -> accepted in the same second (The stub answers no chat requests, so the later checks still fail there by design; they are not part of this change.)
PR Reviewer Guide 🔍(Review updated until commit c9c0ff1)Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 20b9e3fc37 — this is the fix for the flake I filed as #850, and I reproduced all four arms of its table on this box rather than reading them.
Method: the real tests/hybrid_route.sh (this head, and main's version for the A/B) driven with a stub in place of 1bit serve that answers /health 503 for N seconds and 200 after that — the stub answers no chat requests, so the later checks fail by design and are not part of this change. Only the first check and the wall clock matter here.
arm first line elapsed
old loop (main, seq 1 100), 18 s stub FAIL serve starts with the fake provider 11.0 s
new loop (#851), same 18 s stub ok serve starts with the fake provider 18.5 s
new loop, immediate 200 ok serve starts with the fake provider 0.5 s
new loop, never 200, HYBRID_ROUTE_START_S=3
FAIL serve did not answer http://127.0.0.1:51985/health within 3s: last code 503, pid 46102 alive
So: the old loop really does give up in ~11 s on a serve that needs 18 s (that is #850, and it is a try count, not a deadline), the fast path costs nothing (0.5 s wall for the whole harness, no added poll), and the exhausted path now says elapsed, the last status code, whether the pid is alive and the serve log tail — the three things I had to reconstruct by hand when triaging the CI failure.
bash -n clean. shellcheck -S warning reports two SC2034 for reply and out, both pre-existing and both false positives (they are read inside the eval in the next check); main's copy has the same line 103. Copyright header present, as CI's first step re-checks.
One nit, not a blocker: the diagnostic computes the elapsed time as $((SECONDS - deadline + ${HYBRID_ROUTE_START_S:-60})), which is correct but reads as if it could go negative — start=$SECONDS at the top and $((SECONDS - start)) would say the same thing plainly.
|
Persistent review updated to latest commit 6e1d873 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 6e1d87318 (re-verdict after the update-branch onto 1f2dfe99f; own patch identical to
20b9e3fc3 — one file, tests/hybrid_route.sh +14/-2)
Re-checked the behaviour at this head, not the patch text, with the real script and a stub serve that answers
/health 503 until a delay I set:
18 s stub, 20 s budget ok serve starts with the fake provider (the #850 flake arm now passes)
never 200, 3 s budget FAIL serve did not answer http://127.0.0.1:…/health within 3s:
last code 503, pid 1530921 alive (fails fast, names why, ~3 s)
bash -n ok; shellcheck -S warning: only the pre-existing SC2034 at :95 (`reply`, read inside eval)
|
Persistent review updated to latest commit c9c0ff1 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at c9c0ff1cf (re-posted; my verdict is a gate only at the head it names).
Head moved by update-branch only: c9c0ff1cf is Merge branch 'main' into 1bit/i850-hybrid-route-startup with parents 6e1d87318 (the head I verdicted) and 801a4a60c (main). The PR's own commit is untouched, so the earlier evidence — the stub arms: 18 s stub against a 20 s budget starts OK, never-200 against a 3 s budget fails in ~3 s naming 503 and the pid — applies to this tree unchanged.
CI on this head: build SUCCESS, all four Analyze jobs SUCCESS, hw_gate SKIPPED. pr_agent is green again (coder-llm back on :8090), so it is no longer a known-red check.
Nit carried, not a gate: the test asserts the deadline path with a stub server; the real hybrid_route serve is still only exercised by the lane, not by CI.
What
tests/hybrid_route.sh'sstart()waited for/healthwithfor _ in $(seq 1 100); … sleep 0.1; done. The sleep isinside the loop, so the budget was
100 × (0.1 s + one curl)— 6.7 s on a quiet box, 15.2 s on a loaded CI runner.On the runner it exhausted,
start()returned non-zero, and the arm's four checks cascaded into failures that lookedlike a routing defect. Same commit, two runs six minutes apart, pass and fail (engine #850).
The change (one file,
tests/hybrid_route.sh)HYBRID_ROUTE_START_Sso the test can be driven quickly. Wall clock isthe right unit here: the same try count is a different amount of real time on every runner.
/healthcode, whether the pid is alive, andtail -5ofthe serve's log. Today the only signal is the check's own
FAIL …and the end-of-run dump prints 20 lines of a logthe serve had not written yet.
Measured (stub serve answering
/healthwith 503 for ~18 s, then 200; the stub answers no chat requests, so thelater checks fail there by design and are not part of this change)
seq 1 100FAIL serve starts with the fake providerafter 11 s (100 tries exhausted)ok serve starts with the fake provider, accepted at ~18 sHYBRID_ROUTE_START_S=3)FAIL serve did not answer …/health within 3s: last code 503, pid … alive, then the log tail, thenFAIL serve starts with the fake providerbash -nclean. No behaviour change on the passing path, so the six passing CI runs of the last hour stay passing.Closes engine #850.