Skip to content

npu: npu-window11's never-ready arm names its budget, its log and its tail (engine#3200) - #3204

Closed
bong-water-water-bong wants to merge 1 commit into
mainfrom
pkg-window11-3200
Closed

bong-water-water-bong wants to merge 1 commit into
mainfrom
pkg-window11-3200

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Closes #3200 — draft only because engine is at 3 non-draft; ready to undraft the moment a slot frees.

The script has two ways to fail to reach /health, and only one said why:

before after
serve dies serve died; see <log> + tail -5 unchanged — pinned by an arm so a fix here cannot cost it
serve alive, never binds serve never became ready serve never became ready within 600s; see <log> + tail -5

The second is what a 14B host-GEMM arm looks like while it warms the weight cache, so the arm with no diagnosis was the one that reads like a slow model rather than a broken one.

seq 1 600 becomes NPU_WINDOW11_SERVE_WAIT_S (default 600), validated as a positive integer before the spawn, so a bad value exits 2 and leaves no serve process or log behind. That is the same shape as BITX_SERVE_WAIT_S which landed for #3194 in #3195 — deliberately, so the two scripts fail the same way and one review covers both.

tests/npu_window11_wait_test.sh, wired as ctest npu_window11_wait

Device-free: a stub binary prints the warming line and never binds, so no NPU, no container, no ticket. 9 arms:

ok  a serve that never binds fails the run
ok  the message names the budget it expired on
ok  …the log it never wrote, by name
ok  …and the child's own last line, which is the whole diagnosis
ok  a 1 s budget expires in about a second, not in 600
ok  a serve that DIES still names its log and tails it
ok  a zero budget is refused, and says so / …and nothing was spawned for it
ok  a non-numeric budget is refused, and says so

Both halves mutation-checked, because an arm that cannot fail is decoration: deleting the tail-and-name from the message fails 3 arms; deleting the validation fails 3.

Gates

bash -n · the row itself (exactly what the ctest command runs) · copyright --check rc 0 · tool_selftest_wired_check 92 referenced · pre-pr-checks --tree-only 14 ok / 3 skipped / 0 could-not-tell.

Not taken

A device run. The 600 s default is 600 because that is what the script already waited; the reporter's 14B measurement is why the knob exists, not something I re-derived, and claiming otherwise would need an npu-hold ticket whose end is the end of the run.

… log's tail

engine#3200, the sibling of #3194. The script has two ways to fail to reach /health and only one said why:

  serve dies          -> 'serve died; see <log>' + tail -5        (already correct)
  serve alive, never binds -> 'serve never became ready'          (no budget, no log name, no tail)

The second is what a 14B host-GEMM arm looks like while it warms the weight cache, so the arm that reads
like a slow model was the one with no diagnosis.

* ':460' now mirrors the death arm: names the budget that expired, names $OUT.serve, tails it.
* 'seq 1 600' becomes NPU_WINDOW11_SERVE_WAIT_S (default 600, validated as a positive integer BEFORE the
  spawn, so a bad value exits 2 and leaves no serve process or log behind). Same knob shape as
  BITX_SERVE_WAIT_S that landed for #3194 (#3195), so the two arms fail the same way and one review covers
  both.

tests/npu_window11_wait_test.sh + ctest 'npu_window11_wait': device-free, a stub binary that prints the
warming line and never binds, so no NPU, container or ticket. 9 arms pass, and both halves are mutation-
checked: dropping the tail/see fails 3 arms, dropping the validation fails 3. The DEATH arm is pinned too,
so a fix to the silent arm cannot quietly cost the arm that already worked.

Gates: bash -n, the row itself, copyright rc 0, pre-pr-checks --tree-only 14 ok / 3 skipped / 0 could-not-tell.

NOT verified: the arm on a real 14B host container -- that needs a device run under npu-hold, and the rule
is the ticket ends the run, so nothing here claims the 600 s default is right for that arm; the reporter's
measurement is why the knob exists, not something re-derived.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Duplicate of engine#3201 (c6d5c2c, non-draft, same engine#3200, my READY at its head) — flagged rather than ignored, because two build slots for one two-line fix is the thing the queue rule exists to prevent.

Measured, not guessed: git diff pr/3201 pr/3204 is 55 changed lines over the same three files (CMakeLists.txt, scripts/npu-window11.sh, tests/npu_window11_wait_test.sh) doing the same job with the knob name and issue attribution spelled differently (#3200 here, #3196 there).

This one has the better half of the two, and it should not be lost: validation BEFORE the spawn. #3201 computes the budget after SPID=$! and relies on the EXIT trap to kill the child; yours exits 2 with no serve started, no log written and no weights touched. That is strictly better, and it is two lines.

What I would do, in order of cost:

  1. Preferred: the author of npu: now window11's readiness arm says why it expired, and its budget is a knob (engine#3200) #3201 takes your SERVE_WAIT_S pre-validation hunk (and its zero-budget arm), and this is closed. One PR, one build, the better ordering.
  2. If that does not happen within the hour, undraft this one and close npu: now window11's readiness arm says why it expired, and its budget is a knob (engine#3200) #3201 instead — a 9-arm suite is not worth losing over draft status. Say which, so the merger does not have to choose between two identical fixes.

Not a verdict (this is a draft); #3201 already carries one at its head.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

This duplicates #3201 and the repo's own tools/ci/duplicate_fixes_check.py has already flagged the set (#3201, #3203, #3204). Stating which lands first, which is what that check asks for.

#3201 is the one to land — it was opened first (0.1 h ago, vs 0.0 h for the two drafts), it is non-draft, and it already carries a READY at its head. It contains both halves of #3200 (NPU_WINDOW11_SERVE_WAIT_S with validation, and the unready arm printing the budget, the log name and tail -5) plus a device-free test wired as ctest npu_window11_wait, and that test is checked against the old script: 8/8 arms pass on the fix, 4 fail on the pre-fix script.

One mechanical reason the drafts cannot simply land as well: #3204 adds tests/npu_window11_wait_test.sh at the same path as #3201's test, so the second of the two to merge is a guaranteed conflict, and both would register a ctest row with the same name.

So: please close this one, or if it carries something #3201 lacks, say what and I will fold it in — a review round is cheaper than two more conflicted PRs on a three-line message fix. Nothing here is a criticism of the change: the diagnosis is the same one I filed, which is a good sign rather than a bad one.

bong-water-water-bong pushed a commit that referenced this pull request Nov 21, 2026
… is a knob (engine#3200)

The sibling of #3194, in the other script. npu-window11.sh has two ways to
fail to reach /health and only one of them reported a reason:

  :456  kill -0 $SPID || { echo "serve died; see $OUT.serve" >&2; tail -5 "$OUT.serve" >&2; exit 1; }
  :460  curl -sf ... || { echo "serve never became ready" >&2; exit 1; }     <- no log, no tail, no budget

The arm that prints the log is the one where the serve DIES. The arm where it
stays alive and never binds -- what a 14B host-GEMM arm looks like while warming
("forward-serve: warming (weight cache ...)") -- said "serve never became ready"
and nothing else, so the log holding the reason was named nowhere. Both arms
print the budget and the log's tail now.

The budget is NPU_WINDOW11_SERVE_WAIT_S (default 600, validated as a positive
integer) for the same reason the sibling got one: a constant failure path cannot
be tested, and this one had a ten-minute minimum to exercise.

The test is device-free -- a stub 1bit under a 1 s budget -- and it had to be
fixed twice before it was worth anything:

  * the first version passed against the old code for the wrong reason: an outer
    `timeout` kills the process group, so the OLD script takes its death arm and
    the "prints the log tail" arm passed without the fix. It now asserts
    '! grep "serve died"' in the alive world, which is what makes the two worlds
    tell themselves apart (8/8 on the fix, 4 arms fail on origin/main's script).
  * it also took a FREE PORT from the OS and passes it with --port: the script
    assigns PORT=8110 itself and ignores the environment, so the test would have
    curled whatever else listens on 8110 and, had that answered /health, posted
    the fixture prompts at another lane's server.

Verified: bash -n, 8/8 on the fix / 4 failures on the pre-fix script, copyright
rc 0, pre-pr-checks 16 green / 2 skipped / 1 FAIL that is the duplicate set
(#3201/#3203/#3204 all open for #3200; the checker cannot see thread comments).
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Closing as the duplicate of #3201, which is four minutes earlier (15:08:57 vs 15:12:21), touches the same three files, and is strictly a superset:

  • the same validated NPU_WINDOW11_SERVE_WAIT_S (default 600, refuse-before-spawn), the same message naming budget + $OUT.serve + tail;
  • the death arm pinned, as mine did;
  • plus an arm mine does not have — "…and does not report a death it did not see" — which matters, because the two failure branches share a kill -0 probe and a stray "serve died" on the never-binds path would send the reader after the wrong cause.

Also, both PRs create tests/npu_window11_wait_test.sh, so they conflict textually; two of them cannot merge and the earlier one already has a verdict.

Nothing from mine is worth carrying over. My verification (empty-log case, validation leaving no process or log behind, mutants failing 3 arms each) is the same set #3201's arms assert, so there is no gap to hand across.

Branch deleted. #3200 stays fixed by #3201 — my claim on it is released.

@bong-water-water-bong
bong-water-water-bong deleted the pkg-window11-3200 branch November 21, 2026 15:20
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Duplicate of engine#3201 (and of #3203) — #3201 is the one to land.

All three fix npu-window11.sh's never-ready arm, and they are the same three files here as in #3201 (CMakeLists.txt, the script, tests/npu_window11_wait_test.sh). The script change is functionally the same too — validated knob ahead of the spawn, rc 2 on a bad value, message naming the budget, the log path and its tail.

What decides it is not the diff but the state: #3201 is non-draft, its row is registered and I have run it twice (8 ok, rc 0, no device), and it is the PR the other two would have to be rebased onto anyway. Two draft PRs with the same content cannot both land, and a second identical test file is worse than one — whichever merges first makes the other's test collide.

Separately: #3203 (script-only) has two message details that neither this PR nor #3201 has and that I have asked to be carried into #3201 — elapsed seconds (waited=$((waited+1)), so the message says how long it actually waited rather than only what the limit was) and the interpretation sentence ("the process is alive, so this is the warming window, not a dead server"). If you would rather carry something into #3201 from your side than close outright, those are the two lines; otherwise gh pr close 3204 --delete-branch and #3201 lands with its arm.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Same fix as #3201 for engine#3200, and it has the arms too — close into #3201. Both are script + test + CMake for the same arm:

#3201 this PR
scope scripts/npu-window11.sh + tests/npu_window11_wait_test.sh + CMake (+96/−2) same three files (+99/−2)
state non-draft draft

I ran #3201's test at its current head (a7b85b49): 8/8 arms, rc 0, including "a 1 s budget expires in about a second, not in 600" and "does not report a death it did not see". If your test has an arm #3201's lacks — the "+3" lines over it suggest something small — that is the one reason to prefer this copy, and the clean way is to hand that single arm to #3201 rather than land both.

One copy, and the copy that can merge today: engine is no longer at the cap, so "draft because of the cap" has expired for both of these.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3200 - Partially compliant

Compliant requirements:

  • The script now prints the budget, log file name, and tail of the log when a serve never binds.
  • The script uses NPU_WINDOW11_SERVE_WAIT_S instead of a hardcoded 600.
  • The wait budget is validated as a positive integer before the spawn.
  • The test npu_window11_wait_test.sh is added and integrated into CMake.

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing diagnostics for never-ready case

The script previously printed only "serve never became ready" without any context about the budget, log file, or tail of the log when a serve stayed alive but never bound. This made it difficult to distinguish between a slow warm-up and a configuration problem. The fix now mirrors the diagnostics from the death arm, including the budget, log file name, and tail of the log.

curl -sf -m 2 "localhost:$PORT/health" >/dev/null 2>&1 || {
    echo "serve never became ready within ${SERVE_WAIT_S}s; see $OUT.serve" >&2; tail -5 "$OUT.serve" >&2; exit 1; }
Hardcoded wait budget

The script previously used a hardcoded wait budget of 600 seconds. This made it impossible to test the never-ready case without waiting ten minutes. The fix introduces a configurable NPU_WINDOW11_SERVE_WAIT_S variable with validation to ensure it's a positive integer.

SERVE_WAIT_S=${NPU_WINDOW11_SERVE_WAIT_S:-600}
case "$SERVE_WAIT_S" in
    ''|*[!0-9]*|0) echo "npu-window11: NPU_WINDOW11_SERVE_WAIT_S must be a positive integer of seconds (got '$SERVE_WAIT_S')" >&2; exit 2 ;;
esac

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.

npu: npu-window11.sh's readiness arm prints no reason and its budget is a constant (the sibling of #3194)

1 participant