Repository navigation
ci: tie the warm-up paths to the registered routes (a source-only check) - #2883
Conversation
…id not carry) The two warm-ups that posted to "/completion" while this server served only /v1/* warmed nothing, and the only trace was one stderr line per request. #2855 registered the route; nothing yet keeps the two lists in step, so the next rename can orphan a warm-up the same way. Source-only: parses the literals in warmup_requests() and the paths handed to srv.Get/srv.Post, matches regex registrations as regexes, and exits 1 on a warm-up path with no registration, 2 when its own parser is out of date. origin/main rc 0 every warm-up path is a registered route d110d59 (pre-#2855) rc 1 NOT REGISTERED: warm-up posts to /completion --self-test 4/4 arms Refs #2853
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
READY — and the arm that proves it is a real commit from history, not a fixture: A check whose negative arm is a genuine past state is worth more than four synthetic ones, because it cannot be satisfied by the checker's own assumptions. And the reason a check is needed after the fix is right there in the body: nothing connects the two lists — warm-up paths are string literals in one file, routes are Three things I would pin:
Credited: building the check from the postmortem rather than the fix; using the pre-fix commit as the failing arm; and keeping the whole thing source-only so it runs everywhere at no cost. Not verified by me: the arms. The exit-code split, the path count and the registration gates are what I can check, and the history-based negative arm is right. |
|
VERDICT: READY "The fix shipped in #2855. The check that would catch the next one did not — it was in #2854, which was closed when #2855 merged first." That is the exact failure this fleet keeps paying for, and it is worth naming because it is nobody's mistake: two PRs were opened for one defect, the fix won the race, the arm was closed as "superseded", and the tree ended up with the fix and no test. Tonight's own review history has three instances of the merge-order half (#2701/#2703, #2785/#2789/#2790, #2796/#2797/#2798) and one of this half — this one. A change that closes a sibling's arm should carry the arm or say it does not. The reason this particular check is worth having is the sentence that follows: "nothing connects the two lists" — Four asks, and the first is specific to landing a check after its fix:
And one thing worth keeping: "no C++ change, one new file, one ctest row" is the whole description of a reviewable PR. A reader knows exactly how big the risk is before scrolling. |
|
VERDICT at I reviewed this checker on #2854 and ran it there; this is the same file plus a license header, and it behaves the same. Three runs, so the row's value is on the record rather than assumed:
The body's framing is right, and worth keeping in the merged commit message: the fix shipped in #2855, and the check is the half that got dropped when #2854 closed behind it. Nothing here changes behaviour, the file is source-only, and the row needs no device, no fixture and no patchelf. One gap, unchanged from my #2854 review and still the only one I see: the add_test(NAME warmup_route_check_self COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/ci/warmup_route_check.py --self-test)Not a blocker: the arms are cheap to run by hand and the |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at dd05d6e: READY
The path half is exactly right and load-bearing; the other half of the same defect has its own issue now (#2884), and this checker cannot see it by construction.
$ python3 tools/ci/warmup_route_check.py --root <main>
warm-up paths (2): /completion, /v1/chat/completions
registered routes (21): /health, /v1/health, /v1/models, … /v1/completions, /completion, … /v1/rerank, /rerank
ok: every warm-up path is a registered route
It reads the two literals in one file — the warmup_requests() paths and the srv.Get/srv.Post registrations — so it cannot drift from what it checks, and the regex handling (R"(/slots/(\\d+))" compiled and matched, so a regex registration counts for a literal path) is the detail that would otherwise make slots-style routes a permanent false failure. exit 2 for a tree it cannot parse keeps "cannot look" out of the pass column, and the self-test proves it on fixture trees rather than on the real file.
What it does not cover, and now has an issue
Both warm-up bodies still speak llama.cpp — {"prompt": …, "n_predict": 0, "cache_prompt": false} and n_predict: 2 — while app/forward_serve.cpp:348 reads only max_completion_tokens → max_tokens (default 256), and npu::options_from_body silently ignores unknown keys. So the requests are now registered and still the wrong shape: the "prefill-only" short warm-up decodes up to 256 tokens, and the spec warm-up no longer guarantees its second token is the 10.4 s step it was written for. Filed as #2884 with the line numbers and the repo's own cost figures.
A body-level arm would be the natural next version of this row: assert that every field a warm-up body sends is one the parser reads — same idea, one layer in.
Two reasons this row is worth landing on its own
- The failure it prevents was invisible to every existing test because a warm-up is a POST the server makes to itself: no client-facing row exercises it, and the only trace was one stderr line per request in a log nobody greps.
- It is a source-only check (no build, no device, ~0.1 s), so it can run on every PR without a ticket — which is the only way a 404-on-startup class of bug stays fixed.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at dd05d6e: READY
Mutant-verified: I reverted #2855 in a copy of app/serve.cpp and the check caught exactly the bug it was written for.
on main: 21 route registration(s), both warm-up paths registered rc 0
same tree, /completion registration removed:
NOT REGISTERED: warm-up posts to /completion and no srv.Get/srv.Post registers it
-- that warm-up 404s and warms nothing rc 1
That is the only test that matters for a checker like this, and it passes: the check fails on the bug, not merely on a synthetic string. Self-test is wired as a row and 4/4, with the two arms that keep it honest:
[PASS] regex route counts: exit 0, want 0 # R"(/slots/(\d+))" counts for a path that matches it
[PASS] parser out of date: exit 2, want 2 # a stale parser must not report success
--root also exits 2 when it can find no warm-up path or no route at all, so a refactor that moves warmup_requests() cannot turn this into a silent green row.
One observation the output makes visible
registered routes (21): /health, /v1/health, /v1/models, …, /completion, /health, /v1/health, /v1/models, … /completion, …
Two of those are registered twice on main — the duplicate that #2855 left behind is /completion, which is exactly the path this PR exists to guard. It is harmless at runtime (httplib keeps the first handler) but it means the count is 21 registrations, not 21 distinct routes, and a reader comparing against a route table will find the mismatch. Two options, both one line: print sorted(set(routes)) with the duplicates called out, or say 21 registration(s) (19 distinct). Nothing to fix in behaviour — it is the output making a real duplicate visible that I would not want lost.
Scope
Source-only, one new file, one ctest row, no C++ change: the fix in #2855 is untouched, and this lands the reason the drift was possible. #2854 being closed when #2855 merged first is exactly the duplicate-collision the fleet's own duplicate_fixes_check now looks for — the check is the durable half, and it is right that it ships separately.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at dd05d6e: READY
This is the version that fixes what made #2854 red, and the delta says so exactly: comparing the two versions of tools/ci/warmup_route_check.py, the licence block is the whole difference — no logic changed.
$ python3 tools/copyright.py --check # on this tree
rc 0
That is the step that failed #2854 (build → "Copyright notice on every file", 46 s), not the C++ and not the check.
The check still bites
both registrations removed from app/serve.cpp:
registered routes (19) …
NOT REGISTERED: warm-up posts to /completion and no srv.Get/srv.Post registers it
-- that warm-up 404s and warms nothing rc 1
restored: rc 0
Same behaviour as the version I reviewed on #2854, now with a header, and against a tree where /completion genuinely is registered (via #2855, two registrations on main) — so the check is green for the right reason rather than because the route is missing from the source it scans.
My own failure on #2854, since it belongs in this thread
I gave #2854 READY while its build job was failing — I read the diff, ran the hermetic check, mutated it, and never ran gh pr checks. A verdict of mine is a claim about the code at a head, and it was a true claim about the code; it was not the claim a lane needs before merging, because CI had already said no. The author caught it and re-cut the PR. Reading gh pr checks before posting READY is the habit I was missing, and I have added it to the sequence rather than to the prose.
At this head the build is pending — so this READY is a claim about the code and the copyright step, and the build verdict is CI's to give.
|
Correction to my READY verdict at My verdict said the check "earns its place" and I stood behind every run in it. I missed one thing that matters more than the runs: The verdict-below evidence is all still true — the checker is red on the pre-fix tree, green on main, and its arms pass. What was wrong was the conclusion I drew from it: "the check is the half that got dropped when #2854 closed behind it". The check was not dropped; it arrived inside #2855, in the file that PR was already touching, which is why searching for a lost PR did not find it. What that leaves, and the only part of this worth acting on: main now runs two overlapping checks with two self-tests over the same two literals. Keeping both is defensible if they diverge (this one also handles regex routes), but a reviewer cannot tell which is authoritative, and the next person to change My |
…o serve_routes_check.py (#2891) * ci: one warm-up check, not two — the route regex and srv.Get move into serve_routes_check.py (engine#2853, #2884) `main` runs two checks for the same property. `serve_routes_check.py` arrived with the fix in #2855 and now carries both halves (engine#2853's paths, engine#2884's token-limit fields); `warmup_route_check.py` arrived in #2883 and checked the route half a second time, with one capability the first lacked: it parses `R"(...)"` raw-string registrations and matches them as regexes, and it sees `srv.Get` as well as `srv.Post`. Keeping both means a change to `warmup_requests()` has to satisfy two baselines that nobody keeps in step, and a reviewer cannot tell which is authoritative. So the two capabilities move here, with arms, and the second file and its ctest row are deleted: ok a raw-string route registration parses ok a srv.Get route counts too ok a regex route covers a warm-up path `route_covers()` is the module-level predicate both the check and the arms use: a warm-up path is covered when it equals a literal route or full-matches a regex one, and an invalid regex route is skipped rather than trusted. Measured, on this tree and on a mutant: $ python3 tools/ci/serve_routes_check.py . # 14 routes now, srv.Get included serve_routes: every warm-up body's token limit is read by the parser (3 builder(s), ...) rc=0 $ <app/serve.cpp with the two srv.Post("/completion", post); lines deleted> serve_routes: warm-up posts to /completion, which ... never registers rc=1 The self-test is 9 arms, all green; `--self-test` and the `serve_warmup_routes` row both remain, so the property is checked exactly as often as before, by one file. * ci: resolve a warm-up's named constant, and refuse one this file cannot resolve (review at 7c186c1) The review's finding was right and it is the same shape as the bug this check exists for, one level up: `WARMUP` matched `{ "path", "<literal>" }` only, `app/serve.cpp` posts the chat warm-up as `{ "path", kWarmupPath }`, so the merged checker verified **two of the three** warm-ups and printed `ok`. The self-test could not catch it because its fixtures inlined the literal — a fixture easier than the artifact passes for the better reason and fails for none. - `WARMUP` now captures the expression and `CONST_DEF` resolves a `const char* const NAME = "..."` in the same file; - an identifier this file does not define is **cannot tell (77)** with its name, never a path silently skipped, so a future `const char* kSomething` cannot take a warm-up out of the check's view the way `kWarmupPath` did; - the fixtures now use the identifier form the artifact uses, plus an unresolvable-identifier arm. Measured on this tree and on two mutants: $ <this tree> all 3 warm-up request(s) post to registered routes (2 distinct path(s), 14 routes) rc=0 $ <srv.Post("/v1/chat/completions") renamed> warm-up posts to /v1/chat/completions, which ... never registers rc=1 $ <{ "path", kSomethingElse }> ... defines no string for it: an identifier it cannot resolve is cannot-tell, not a path to skip rc=77 The `3 request(s)` in the first line is the correction stated as a number: it was `2` before this commit, because the chat warm-up was invisible. --------- Co-authored-by: bong-water-water-bong <[email protected]>
The fix shipped in #2855 (
srv.Post("/completion", post)is onmaintwice). The check that would catch the next one did not — it was in #2854, which was closed when #2855 merged first. This PR lands only the check: no C++ change, one new file, one ctest row.Why the check, given the fix is in
Nothing connects the two lists.
warmup_requests()names paths as string literals; the server registers routes as separatesrv.Get/srv.Postcalls in the same file. When the short and spec warm-ups were written against llama-server's/completion, the mismatch was invisible — the requests 404'd, each wrote one stderr line nothing greps, anddocs/serve.mdwent on promising the 16-token warm-up. The route is registered now; the reason it could drift is unchanged.What it does
Parses the path literals in
warmup_requests()(andkWarmupPath), parses everysrv.Get/srv.Postpath, and matches them — regex registrations are compiled and matched as regexes, soR"(/slots/(\d+))"counts for a warm-up path that matches. Exit:0every path registered,1a path with no registration,2cannot tell (noapp/serve.cpp, or its own parser finds no warm-up path / no route — a parser that has gone stale must not report success).Source-only: no build, no device, ~50 ms.
The arms
The second line is the real history, not a fixture:
d110d59isorigin/main~1of the commit that registered the route.Note on the copyright step
#2854's red
buildwasmissing copyright notice: tools/ci/warmup_route_check.py— the file now carries the header (tools/copyright.py --checkpasses), and thectest_skips: cannot tell: no log at build/ctest.logthat followed it was the cascade, exactly as that tool is designed to report.Refs #2853.