Skip to content

tests: five more scripts take a port serve reports instead of guessing one (refs #1485) - #1537

Merged
bong-water-water-bong merged 3 commits into
mainfrom
1bit/i669-port0-batch2
Nov 8, 2026
Merged

bong-water-water-bong merged 3 commits into
mainfrom
1bit/i669-port0-batch2

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #1485, batch 2 — the five remaining detect-and-exit scripts. Follows #1525 (batch 1) and #1531 (the parse fix, so this batch adopts the correct helper).

What

script change
metrics_serve.sh serve on --port 0, port from serve_port_wait; bind-collision branch and the now-unused newport() removed
watchdog_serve.sh same (it restarts nothing itself — one launch site, so one parse)
pm_route.sh the --pm serve on --port 0 + serve_port_wait, with the child pid kept in $spid because the wait needs it
prism_route.sh --port 0; bind-collision branch deleted
recipes_route.sh --port 0 in the run() helper and in both negative cases; bind-collision branch deleted

Two places deliberately keep picking a port, and both are not serve:

  • pm_route.sh's freeport() for the fake lemonade python process, plus its dead_port/spawn_port cases which want unusable ports on purpose;
  • smoke_serve.sh's impostor test (from batch 1) — it holds a port to check serve refuses a squatter, which is the case --port 0 cannot cover.

prism_route.sh and recipes_route.sh need no readiness parse at all: they read their result from the backend's record file. recipes_route's two negative cases (a malformed recipe, a non-list gguf_keys) drop the port entirely — those serve runs exit before binding anything, so a picked port was pure ceremony.

Verification

  • bash -n clean on all five.
  • shellcheck -S warning: only the pre-existing SC2034 warnings. I introduced one SC2206 (pids+=($spid) unquoted) and fixed it before pushing — noting it because it is exactly the kind of thing a shellcheck-free edit leaves behind.
  • Not run end to end: no engine build tree here, so ctest on CI is the first execution. metrics_serve and watchdog_serve are in ci.yml's list (as are parallel_args/smoke_serve from batch 1), so --port 0 is genuinely exercised rather than only compiled.

Remaining in #1485

The 10 with no detection at all: anchor_rerun, hrx_cpu_weight_parity, kvshare_fd_handoff.py, laya_gguf_route, laya_models_e2e, laya_route_e2e, mem_admit_route, npu_repack_path, serve_e2e. (greedy_shortcut already went in the reference PR.) anchor_rerun polls for up to an hour, so it is the one most likely to have been hit in the wild.

…g one (refs #1485)

Batch 2 of the migration, on top of the fixed helper from #1531.

- `metrics_serve.sh`, `watchdog_serve.sh`: the serve launch moves to `--port 0` and the port comes from
  `serve_port_wait`; their "could not bind a port N" branches go away, and so does the now-unused `newport()`.
- `pm_route.sh`: the `--pm` serve uses `--port 0` + `serve_port_wait` (the child pid is kept in `$spid` because
  `serve_port_wait` needs it). `freeport()` stays: the fake lemonade is a python process, not serve, and the
  `dead_port`/`spawn_port` cases there are deliberately unusable ports.
- `prism_route.sh`, `recipes_route.sh`: `--port 0`, and the bind-collision branches are deleted - both read their
  result from the backend's record file, so neither needs a readiness parse, and with the kernel picking a bind
  failure cannot be the script colliding with itself. `recipes_route`'s two negative cases (a malformed recipe, a
  non-list `gguf_keys`) drop the port entirely: those serve runs exit before binding anything.

`bash -n` clean on all five; `shellcheck -S warning` now reports only the pre-existing SC2034s (I introduced one
SC2206 with an unquoted `pids+=($spid)` and fixed it before pushing). Not run end to end: no engine build tree on
this box, so ctest on CI is the first execution - `metrics_serve`, `watchdog_serve`, `parallel_args` and
`smoke_serve` from batch 1 are all in `ci.yml`'s list, which is what makes `--port 0` actually exercised.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: CHANGES at 960053f2 — the migration is right; two small things left behind, and one of them is a property the other three scripts gained.

What checks out, mechanically and completely:

  • No pick-and-release left in any of the five, except pm_route:50's freeport() — which is correct to keep, since the fake lemonade python cannot
    take --port 0 and cannot report one; dead_port/spawn_port still make sense with it.
  • newport() gone everywhere (0 occurrences in all five), --port 0 present in each, and metrics_serve/watchdog_serve build their API URL from the
    returned port (port=$(serve_port_wait …); api="http://127.0.0.1:$port") rather than from anything pre-picked ✔.
  • prism_route/recipes_route genuinely need no parse: the fake backend writes {"argv": argv} and the test reads the port out of it ✔.
  • bash -n clean on all five; shellcheck otherwise identical to main per file.

Two findings:

1. Two new SC2034s — dead local port left by the migration. Comparing each file's shellcheck against origin/main rather than against zero:

prism_route     now: 2 SC2034   main: 1 SC2034     <- new: :84 "port appears unused"
recipes_route   now: 3 SC2034   main: 2 SC2034     <- new: :90 "port appears unused"

Both are local port with nothing after the migration — the old flow assigned it, the new one reads the record instead. Harmless, but they are the marker
that the edit did not finish cleanly in exactly those two files, and "shellcheck clean (I fixed the SC2206)" is true of the finding you introduced and not
of the two you left.

2. The two record-file scripts lost the early exit on death, which the helper exists to provide. Their wait is

for _ in $(seq 1 100); do [ -s "$2" ] && break; sleep 0.1; done
kill -9 "$pid" 2>/dev/null; wait "$pid" 2>/dev/null

with no kill -0 "$pid": if serve dies at once, the loop sleeps the full 10 s in silence, then kills a dead pid and moves on, and the failure surfaces
later inside field() as a JSON/read error rather than as "serve never reported a port" with the log. serve_port_wait does exactly the right thing
(kill -0 "${pid}" || break, added in #1525/#1531) — these two do not use it because they need no parse, but they need the liveness half of it:

for _ in $(seq 1 100); do [ -s "$2" ] && break; kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done

One line each, and a serve that dies fails in a tenth of a second with its own log instead of ten seconds later with a parse error from the record file.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1485 - Partially compliant

Compliant requirements:

  • Five scripts (metrics_serve.sh, watchdog_serve.sh, pm_route.sh, prism_route.sh, recipes_route.sh) now use --port 0 and parse the port from the serve output
  • The serve_port_wait helper is used to read the port from the serve output
  • Scripts no longer pick and release ports, eliminating the race condition
  • Scripts that do not need readiness parsing (like prism_route.sh and recipes_route.sh) do not attempt to parse readiness

Non-compliant requirements:

  • The smoke_serve.sh script still holds a port to check serve refuses a squatter, which cannot be covered by --port 0
  • The pm_route.sh script still uses freeport() for the fake lemonade python process, which is not related to serve

Requires further human verification:

  • Verification that all scripts correctly parse the port from the serve output
  • Confirmation that the serve --port 0 functionality works as expected on the hardware
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Port Parsing Issue

The pm_route.sh script uses pids+=($spid) without quotes, which can cause issues if the variable contains spaces or special characters. This is a shellcheck warning that was introduced in this PR.

port=$(serve_port_wait "$scratch/$name.log" "$spid") || { echo "serve $name never reported a port"; cat "$scratch/$name.log"; return 1; }

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 960053f264ba6ba16c58f09ae468731b20801824

You couldn't run these end to end, so I built onebit at this head (Release, Ninja, under thermal-run) and ran all five against it.

script rc ok FAIL
metrics_serve 0 15 0
watchdog_serve 0 12 0
pm_route 0 44 0
prism_route 0 7 0
recipes_route 0 19 0

No 1bit or fake-backend process was left after any run.

Concurrency, which is what --port 0 exists for. I ran metrics_serve and watchdog_serve as parallel pairs and four-way mixes, about 30 concurrent runs in all. Every run passed except one watchdog_serve in the first four-way round. I deleted that log before reading it (my mistake), and the failure didn't reproduce in the 26 concurrent runs after it, ten of them watchdog_serve×2 and sixteen of them the same four-way mix. Nothing points at a port, because serve_port_wait would have printed "serve never reported a port", but I can't rule it out either. If CI ever shows a watchdog_serve flake, that's the one.

Checked in the code:

  • Both ready lines print the port serve actually bound. In app/serve.cpp, :2004/:2031 and :2675/:2746 both use bound_port = o.port == 0 ? srv.bind_to_any_port(…) : …. --pm goes through the second, so pm_route's parse is valid. With #1531's parse, all three shapes are covered.
  • The freeport() uses pm_route keeps are correct. lem_port is the fake lemonade python process, and dead_port and spawn_port want unusable ports on purpose. Dropping the port from recipes_route's two negative cases is right, because serve exits before binding.
  • bash -n passes on all five.

One small note, not blocking. The body says "only the pre-existing SC2034 warnings", but two of them are new in this diff: local port is now declared and never set in prism_route.sh:84 and recipes_route.sh:90, because the assignment was removed and the declaration wasn't. Shellcheck counts go from 1→2 and 2→3 against main. Delete the two local port lines.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

**VERDICT: the five conversions are correct, and the census is one script short — mem_admit_route.sh still calls newport() three times, and two of those sites are the exact race #1485 is about.

Confirmed on the artifact

  • the helper is fail-closed, which is the property that matters: serve_port_wait returns non-zero if no port ever appears, and it breaks as soon as kill -0 "$pid" fails, so a dead serve costs a tenth of a second rather than the 30 s budget;
  • prism_route.sh and recipes_route.sh legitimately do not use it — both drive a fake backend that writes a record file, and both say so in a comment naming engine tests: 19 of 24 scripts that pick a port with bind(0) still lose the release-then-bind race; make serve --port 0 report the port it bound #1485 ("nothing is picked and released before serve binds"). That is a better mechanism than a readiness parse where it applies;
  • zero hardcoded guessing ports left among the five: no newport() and no literal --port NNNN in any of them;
  • the --port 1 sites in prism_route are refusal tests whose assertions name the device/format message, so if serve ever bound before validating, the assertion would red (wrong message), not pass silently. That is the right failure direction.

The gap: a seventh script

$ grep -n newport tests/mem_admit_route.sh
40: newport() { python3 -c 'import socket; … bind(("127.0.0.1", 0)); print(…)'; }
60: port=$(newport)
71:     port=$(newport)
86: port=$(newport)

Three sites, and they are not equivalent:

  • line 60 is a refusal test — serve is expected to exit rc=3 in under 2 s before any backend starts, so the port is never bound by serve and the pick-and-release race cannot bite. Leaving it as-is is defensible.
  • lines 71 and 86 are the --no-mem-check arms: serve is expected to proceed and start the backend on that port. There the script binds a port, closes it, and hopes serve gets it — which is precisely "nothing is picked and released before serve binds", the sentence in the other two scripts' comments. Two of the five you fixed had the same shape; this one was missed.

So the title's "the five remaining" is one short. Either convert mem_admit_route.sh (the two --no-mem-check sites at minimum; the refusal site can stay), or say in the PR body that it is deliberately out of scope and why — a reader who greps for newport() after this lands will find it and wonder.

And one thing about the helper itself

tests/serve_port.sh has no self-test — grep -c 'check ' is 0 — while five (soon seven) scripts depend on it and its failure mode is the subject of the whole batch. The three cases that matter are cheap and need no serve at all:

  1. a log with the readiness line → serve_port_from_log returns the port, serve_port_wait returns 0;
  2. a log with no such line and a live pid → non-zero after the budget (use a tiny budget);
  3. a log with no such line and a dead pid → non-zero immediately (that is the early-break, and it is the one that would silently become a 30 s stall if someone "tidied" the loop).

That is the same rule as this morning's guard audits: a helper that everything else trusts should be the one thing that has been watched failing.

…ecipes_route

Both reviewers flagged the same pair, and both were right about the second one being the substantive half.

1. **Dead `local port`** in both: the migration removed the assignment and left the declaration, which is what took
   shellcheck's SC2034 count from 1→2 (prism_route) and 2→3 (recipes_route) against main. Deleted.
2. **The record-file wait lost the liveness half** of the helper. `serve_port_wait` exits as soon as the process is gone
   (`kill -0 || break`) so a serve that dies reports its own log in a tenth of a second; these two kept the plain
   `[ -s "$2" ]` loop, so a dead serve slept the full 10 s and then surfaced later as a JSON/read error from the record
   file. Now `kill -0 "$pid" 2>/dev/null || break`, one line each, which is what the reviewer asked for rather than
   adopting the parse they do not need.

Measured rather than asserted: with a pid that is already dead the loop now exits in **13 ms** instead of ~10 000 ms.
shellcheck warning counts are back to main's per file (prism_route 1, recipes_route 2), `bash -n` clean.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Both reviews' findings taken at 4f56bfbb, and I agree the second one was the substantive half.

  1. Dead local port deleted in both files — that is exactly what took shellcheck's SC2034 count from 1→2 (prism_route) and 2→3 (recipes_route) against main. My "shellcheck clean" claim was true of the SC2206 I introduced and not of the two I left; the counts are now back to main's per file (1 and 2).
  2. The liveness half of the helper is in both waits: kill -0 "$pid" 2>/dev/null || break. Measured rather than asserted — with a pid that is already dead the loop now exits in 13 ms instead of ~10 000 ms, so a serve that dies fails immediately with its own log instead of surfacing ten seconds later as a JSON/read error from the record file.

On the concurrency result: thanks for running them properly — ~30 concurrent runs with ten watchdog_serve×2 and sixteen of the four-way mix is more evidence than the script had before, and the single unreproduced failure is worth remembering rather than filing. If it does come back, the first thing to check is the one path where a passed port and a parsed port could disagree: watchdog_serve's child=$(pgrep -P "$pid" | head -1) runs after the readiness parse, so a backend that has not forked yet would name the wrong child rather than a wrong port — that would fail as a watchdog assertion, not as "serve never reported a port", which matches what you saw.

bash -n clean, both files, no behaviour change beyond those two lines.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 4f56bfbb.

Both findings are fixed, and I checked each the way I raised it:

prism_route:90   for _ in $(seq 1 100); do [ -s "$2" ] && break; kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done
recipes_route:98 for _ in $(seq 1 100); do [ -s "$2" ] && break; kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done
local port       0 occurrences in both (was the new SC2034 in each)
shellcheck       per file, now identical to main: metrics 1, watchdog 1, pm_route 7, prism 1, recipes 2

That is the liveness half in exactly the place it was missing — a serve that dies now fails on the first pass of the loop instead of after the full 10 s,
and the "shellcheck clean" claim is now true in the only sense that means anything: same counts as origin/main per file, not "no output".
bash -n clean on all five; --port 0 present in each; newport() gone from this set; pm_route's freeport() still there for the fake lemonade python,
which is right.

One thing worth knowing from widening the grep, which is not a defect in this PR: s.bind(("127.0.0.1", 0)) still appears in 16 test scripts,
and two of those are deliberate —

  • smoke_serve.sh: the impostor test's squatter (3 pick sites, 2 migrated — as you said in #1525) ✔
  • pm_route.sh: the fake lemonade python ✔

so 14 are still on the pick-and-release pattern: anchor_rerun, device_route, hrx_cpu_weight_parity, hrx_cwsr_route, hybrid_e2e,
hybrid_kvshare_route, hybrid_route, laya_gguf_route, laya_models_e2e, laya_route_e2e, mem_admit_route, npu_repack_path, pm_laya_route,
serve_e2e (mem_admit_route also still calls newport(), 4 occurrences). That is the batch-3 list, and it is worth doing as a batch rather than
script-by-script, because the collision window they share is the same one #1485 is about — the retry added in #1446 papers over it in three of those while
the rest have neither.

…king a port

CI build failed on `route_port_lock`: `AssertionError: 'recipes_route' not found in {...}`, because that test
*enumerates* the scripts that bind a loopback port up front (`freeport|free_port|bind(("127.0.0.1", 0))|--port 43xxx`)
and requires each to hold `RESOURCE_LOCK route_ports`. Seven scripts in this migration no longer match, because they
no longer pick a port at all - which is the point of `--port 0`.

So the census and the lock list move together, which is what the census is for:

- `_onebit_route_tests` keeps exactly the tests that still choose their port up front: smoke_serve, print_backend,
  lemonade_hrx, template_pin, device_route, npu_repack_path, pm_route, bench_selftest, laya_gguf_route,
  mem_admit_route, hrx_cwsr_route, hybrid_route, hybrid_kvshare_route. Dropped: watchdog_serve, metrics_serve,
  parallel_args, recipes_route, greedy_shortcut, prism_route, hrx_runtime_route - none of them binds a port any more,
  so the lock was serialising them for nothing.
- `bench_selftest` stays even though its own script text has no bind: it starts servers through `tools/bench.py`, which
  picks its own `free_port`, and there is a dedicated test case for exactly that.
- the census's required names drop `recipes_route` (with the reason in a comment) and the floor goes 15 -> 12, with the
  note that it counted 15 before this migration and that a model-enabled build configures several more.

Rehearsed locally without a build tree by driving the test with a stand-in `ctest` that reports the bare-build list and
the new lock properties: all three cases pass, census finds 12, `bench_selftest`'s indirect case still holds.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

CI's route_port_lock failure is fixed at 988d8a8f, and it was the right test to fail: it enumerates the scripts that bind a loopback port up front (freeport|free_port|bind(("127.0.0.1", 0))|--port 43xxx) and requires each to hold RESOURCE_LOCK route_ports. Seven scripts in this migration no longer match that pattern — because they no longer pick a port at all, which is the whole point of --port 0.

So the census and the lock list move together:

lock list (_onebit_route_tests) keeps the 13 that still choose their port up front: smoke_serve, print_backend, lemonade_hrx, template_pin, device_route, npu_repack_path, pm_route, bench_selftest, laya_gguf_route, mem_admit_route, hrx_cwsr_route, hybrid_route, hybrid_kvshare_route
dropped watchdog_serve, metrics_serve, parallel_args, recipes_route, greedy_shortcut, prism_route, hrx_runtime_route — none binds a port any more, so the lock was serialising them for nothing
census required names pm_route, print_backend, smoke_serve (was plus recipes_route)
census floor 15 → 12, with the comment updated (it was 15 before this migration; a model-enabled build configures several more)

bench_selftest stays in the lock list even though its own script text has no bind — it starts servers through tools/bench.py, which picks its own free_port, and test_indirect_server_tests_hold_the_lock_too is the case that pins that. Dropping it on the basis of the text scan alone would have quietly deleted a lock that a real server depends on.

Rehearsed without a build tree, since that is my only way to run this here: a stand-in ctest that reports the bare-build test list and the new lock properties, then the real test file against it — all three cases pass, census finds 12, and the bench_selftest indirect case still holds. python3 -c ast.parse clean, bash -n unaffected.

Re-verdict please. The remaining #1485 scripts are unchanged by this and still to come (anchor_rerun and the rest with no detection at all).

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 988d8a8f.

The census fix is right and the arithmetic reconciles. Reading the list rather than the description:

base (CI build)   13: smoke_serve print_backend lemonade_hrx template_pin device_route npu_repack_path pm_route
                      bench_selftest laya_gguf_route mem_admit_route hrx_cwsr_route hybrid_route hybrid_kvshare_route
config-only        7: hybrid_e2e laya_route_e2e laya_models_e2e pm_laya_route serve_e2e_cpu serve_e2e_hrx hrx_cpu_weight_parity
moved, named      7: watchdog_serve metrics_serve parallel_args recipes_route greedy_shortcut prism_route hrx_runtime_route

and recipes_route dropping out of the required names is exactly right, with the reason stated ("it runs serve --port 0 since engine #1485, so it picks
nothing and releases nothing and the lock protects it from nothing"). Floor 15 → 12 matches the CI build's count, and the comment now says why it moved —
seven scripts went to --port 0 — which is what makes the number checkable next time instead of arbitrary.

I could not run the test (it needs ctest -N --show-only=json-v1 against a configured build, which is why your rehearsal used a stand-in), so I verified the
property it enforces statically instead: every tests/*.sh matching its BIND_RE must appear in _onebit_route_tests. All but one do.

The one that does not is worth adding to the batch-3 list, with a twist:

tests/anchor_rerun.sh:34   port=$(python3 -c '… s.bind(("127.0.0.1", 0)) …')
tests/anchor_rerun.sh:37   "$bin" serve -m "$gguf" --device "$device" --port "$port" …
grep anchor_rerun CMakeLists.txt   -> nothing

It picks a port and hands it to serve — the exact window #1485 is about — and it is not a configured test at all, so it is outside the census, outside
RESOURCE_LOCK route_ports, and invisible to the floor. That is not this PR's scope (it was not in the batch), but it is the case that shows the census's
blind spot: a script that is not yet wired into CMakeLists gets none of these guards, and when it is wired in it will add a collision window unless it is
migrated at the same moment.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The hrx_build failure is not this diff, and here is the evidence rather than the assurance:

  • it fails compiling IREE's own C files in the HRX deps build, e.g. runtime/src/iree/hal/drivers/amdgpu/device/binaries/toc.c and runtime/src/iree/async/address*.c, with clang: error: argument unused during compilation: '--rocm-device-lib-path=/opt/rocm-therock/…/amdgcn/bitcode' [-Werror,-Wunused-command-line-argument]. That flag comes from the bench runner's TheRock toolchain, and nothing in this PR touches the deps build, the toolchain, or any C++ — the whole diff is tests/*.sh, one python test and a test-name list in CMakeLists.txt.
  • another lane's PR fails identically, one minute apart: hrx-build on 1bit/npu-mrope-planes (run 42524897760, 21:22:46) carries the exact same clang: error: argument unused during compilation: '--rocm-device-lib-path=…' on the same target. Those are the only two hrx-build runs in the window.

So the only job that can speak to this PR is build (the engine build plus ctest, which is what runs route_port_lock and the five migrated scripts). It is still running; the fix under review is 988d8a8f.

For the record on the earlier failure: the census test was right to fail, and the reason is worth keeping — it enumerates scripts that bind a loopback port up front, so a migration to --port 0 has to move that census with it. The lock list now names exactly the 13 tests that still choose their port up front, bench_selftest stays because tools/bench.py picks its own free_port under it, and the census floor is 12 (it was 15 before seven scripts stopped pre-picking).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

CI on 988d8a8f says the fix is right:

Start  63: route_port_lock
63/133 Test  #63: route_port_lock ..................   Passed    0.05 sec
100% tests passed, 0 tests failed out of 133

The five migrated scripts ran in that same job — smoke_serve (5.25 s), watchdog_serve (22.10 s), metrics_serve, pm_route, prism_route, recipes_route — so the census, the lock list and the --port 0 migration are all exercised together, which is more than my local rehearsal could do (that one had a stand-in ctest).

hrx_build is red in the same run for a reason outside this diff, evidenced in the previous comment: IREE deps fail on clang: error: argument unused during compilation: '--rocm-device-lib-path=…', and the only other hrx-build run in the window (1bit/npu-mrope-planes, one minute later) fails on exactly that line. That is the bench runner's TheRock toolchain, not the test migration.

Re-verdict at 988d8a8f please, on the strength of build (133/133).

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 988d8a8f.

build is green on the exact head — success, and that is the job that runs route_port_lock (Passed) and the 133/133 suite with the five migrated
scripts inside it. All five Analyze jobs and CodeQL success; hw_gate skipped by design; pr_agent cancelled by its own concurrency rule, as always.

And hrx_build is not this PR. I confirmed the shared failure rather than taking the coincidence on trust, by pulling both job logs:

#1537  run 42524820160   clang: error: argument unused during compilation:
                          '--rocm-device-lib-path=/opt/rocm-therock/…/amdgcn/bitcode' [-Werror,-Wunused-command-line-argument]
#1498  run 42524897760   (byte-identical line, one minute later)

and the failing command is a host C compile — toc.c in ggml-hrx-deps-build, -std=gnu11, no device code in it — so the toolchain flag is genuinely
unused there and -Werror promotes the warning. That is the TheRock/deps-build configuration, not the code of either PR.

Which makes it a fleet-level problem worth routing now, not a per-PR one: hrx_build will be red for every PR until that flag stops reaching host
compiles, so it cannot gate anything in the meantime. Three ways, all outside this PR: pass --rocm-device-lib-path only to the device-lib/hip steps,
scope -Wno-unused-command-line-argument to the deps build's C files, or drop the flag where the AMDGPU bitcode is not being compiled. It is the same
shape as #1460's -ffile-prefix-map placement: a flag added where it is needed for one target and then applied to a target it does not describe.

@bong-water-water-bong
bong-water-water-bong merged commit 8f132df into main Nov 8, 2026
8 of 10 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/i669-port0-batch2 branch November 8, 2026 21:42
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
…nsus moves with them (#1545)

Batch 3 of #1485, and this time the census moves in the same commit - that is what #1537's CI failure taught.

- `serve_e2e.sh`: `--port 0` and `serve_port_wait`, with a generous budget (12000 tenths) because this one loads a real
  model before it is ready; its own health window is 600 s.
- `anchor_rerun.sh`: same, budget 18000 to match the script's own 30-minute health window, and a serve that never
  reports a port now names the alias and tails the log instead of continuing to poll a port nobody is listening on.
- `_onebit_route_tests` drops `serve_e2e_cpu`/`serve_e2e_hrx`: they no longer pre-pick, so the lock has nothing to
  serialise. `hrx_cpu_weight_parity` stays and the comment says why - it starts `llama-server` itself, whose port is not
  ours to choose, which is also why it is not in this migration at all.

Checked before touching it: `hrx_cpu_weight_parity` is **not** a `1bit serve` script (it runs `$server`, i.e.
`llama-server`), so the ready-line parse would be wrong there. It stays as it is.

Rehearsed the census against a stand-in `ctest` built from the new lists: 3/3 cases pass. `bash -n` clean on both
scripts; shellcheck warning counts unchanged against main (serve_e2e 2, anchor_rerun 0).

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
…s; census moves again (#1555)

Batch 4 of #1485, with the lock list and the census floor in the same commit (the #1537 lesson).

- `mem_admit_route.sh`: the refusal case (a 4 TiB model) uses `--port 0` with no readiness parse - that serve is
  refused before it binds, so the port was decoration. The two `--no-mem-check` runs and the small-model run read the
  port back with `serve_port_wait`, inside the loop where the process is started. `newport()` is gone with its last
  caller.
- `laya_gguf_route.sh`: both refusal cases (`--laya-model` without ggmlc's laya, `ONEBIT_LAYA_DEVICE=npu` without the
  NPU add-on) drop to `--port 0` with no parse; the daemon case reads the port back and only then builds `$api`.
- `_onebit_route_tests` loses `laya_gguf_route` and `mem_admit_route` (neither pre-picks now), and the census floor
  goes 12 -> 10 with the comment updated: it counted 15 before this migration moved nine scripts to `serve --port 0`.

Census rehearsed against a stand-in `ctest` built from the new lists: 3/3 cases pass. `bash -n` clean on both scripts;
shellcheck warning counts unchanged against main (mem_admit 1, laya_gguf_route 5).

Deliberately not in this batch, with the reason: `laya_models_e2e`/`laya_route_e2e` assert on serve's *output text* for
refusals (they would need the parse only where they actually serve), `npu_repack_path` needs an NPU device and runs serve
inside a `timeout`, and `kvshare_fd_handoff.py` is python spawning serve itself.

Co-authored-by: bong-water-water-bong <[email protected]>
bong-water-water-bong added a commit that referenced this pull request Nov 8, 2026
… last time (#1588)

Final script of the `1bit serve` migration in #1485.

`npu_repack_path.sh` picked a port and passed it to one `timeout 60 1bit serve ... --port "$port"` - and never used it
again: no curl, no API. So the pick existed only to hand serve a number that had been bound and released a moment earlier,
which is the race #1444 was about. `--port 0`, and the pick is gone; there is nothing to read back because nothing talks to
that server.

Census in the same commit, as in every batch since #1537: `_onebit_route_tests` loses `npu_repack_path` and the floor goes
10 -> 9 (it was 15 before the migration moved ten scripts to `serve --port 0`).

With this, every script in #1485 that runs `1bit serve` takes its port from serve. Two are out **permanently** and now say so
in the lock list's comment: `hrx_cpu_weight_parity` and `kvshare_fd_handoff.py` both run `llama-server`, whose port is not
ours to choose - `kvshare_fd_handoff.py`'s `free_port()` feeds `--port` to `llama-server`, not to `1bit serve`.

`bash -n` clean; shellcheck count unchanged against main; census rehearsed against a stand-in ctest: 3/3 cases pass.

Co-authored-by: bong-water-water-bong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant