Repository navigation
os/v3/puppy: the NPU busy row also covers a non-streamed client, which must be refused at its short bound - #1033
Conversation
`chat-npu-queue` (merged in #1031) starts a 16-token streamed chat 1 s into a 1000-token one and requires the second to be ANSWERED. Both of its arms stream, so it cannot see the other half of the same fix: a **non-streamed** request has no way to say "queueing" - no chunk, no comment, no header - so the serve keeps a short bound for it (`--queue-ms-plain`, 5000 ms) and answers `503 + Retry-After: 1` with `type: device_busy`, which a client can act on. Lemonade's agentic tool loop is exactly such a call site (`LLMChatPanel.tsx:654`), which is how this was found. * `chat-npu-queue-plain`: the same long streamed chat owns the device; 1 s in, a NON-streamed 16-token chat is sent. It must come back 503, naming the device as busy, with a numeric `Retry-After` - and the long chat must still finish with `[DONE]`, with no new TDR. * `plain_queue_verdict()`: the pure decision function, and `--self-test` pins its eight cases - the refusal shape PASSes; being *answered* while the device is busy FAILs (that would mean the bound did not apply), as do a missing `device_busy` marker, a missing or non-numeric `Retry-After`, no status, a long chat cut before `[DONE]`, and a TDR during the arm. * `auth_post_watch()`: a POST whose status, headers and body are all evidence (the `got`/`got_slow` helpers collapse a status into "did it answer", which is why the refusal was invisible before). Measured on this box before writing it (`npu-hold -l npu-1024-plain`, 2026-11-04 18:28:45-18:29:02): A streamed 1000 tok = 200, 14.76 s, 611 SSE frames; B non-streamed 16 tok started 1 s in = **HTTP 503 at t=5.001997 s** with `{"error":{"message":"the NPU is busy with another request","type":"device_busy"}}` and `Retry-After: 1`; 0 driver errors, 0 TDR. Honest about what it can and cannot catch: the non-streamed bound is unchanged by #1031 (it is main's 5 s bound, kept deliberately), so this row passes on a pre-#1031 payload too. Its job is to keep it that way - if someone later points the plain arm at the long queue, this row goes red instead of a tool-loop call silently hanging - and to make the asymmetry visible in the shipped check rather than only in the docs. `bash os/mini/release-check.sh --self-test` -> `release-check self-test PASS`.
PR Reviewer Guide 🔍(Review updated until commit bc76a63)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 a399b3494
This is the arm I asked for in the #1031 review — the one chat-npu-queue cannot see — and it is built the right way round: the pass is a refusal at the short bound, and being answered while the device is busy is the failure.
$ bash -n os/mini/release-check.sh -> ok
$ sh os/mini/release-check.sh --self-test -> release-check self-test PASS
plain_queue_verdict's 8 cases: 503+Retry-After+device_busy PASS; 200-while-busy FAIL; no Retry-After FAIL;
a 503 that says something else FAIL; status 000/empty FAIL; the long chat cut FAIL; a TDR during the arm FAIL;
unreadable dmesg PASS with the caveat said out loud
The row is PSHORT with no "stream" field (so the engine takes the --queue-ms-plain path) behind a 1000-token
streamed PLONG, and auth_post_watch() captures status + Retry-After from headers rather than from the body, with a
wget -S fallback that says what it cannot see. Registered hardware-only (:26, :40), and it reuses the same
tdr_count() bracketing as its streamed sibling.
One nit, and it is the only reason this is not a clean sweep — read it before someone runs the check under bash:
PPID=$! at :1085 uses a name bash owns. Verified on this box:
dash rc=0 waited 3s assignment took: yes
busybox ash rc=0 waited 3s assignment took: yes <- this is what the appliance's /bin/sh is
bash rc=127 waited 0s assignment took: no ("PPID: readonly variable")
So on the board (shebang #!/bin/sh → busybox) the row works, and in a VM the row is skipped because there is no
/dev/accel — the failure is only reachable by running the script with bash on a machine that has an NPU, where the
wait would return 127, PLONG_BODY would be read before [DONE], and the row would FAIL falsely. Rename it
(LPID=$!, as the streamed row's QPID already does) and that whole class is gone; it is worth the one word because
the appliance's shell is not the only one that will ever run this file.
|
Persistent review updated to latest commit bc76a63 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at bc76a630
Rebase-only: own contribution hashes to e738073a5161 at this head and at a399b3494 — 101 lines, +101/−2, identical. My review stands as posted, including the one nit: PPID=$! at release-check.sh:1085 is a name bash makes readonly, so wait "$PPID" returns 127 and the row reads the long body before [DONE]; dash and busybox ash (the appliance's /bin/sh) take the assignment fine, which is why the shipped path works, but the one-word rename (LPID=$!, as the streamed row's own QPID does) removes the class.
Why
chat-npu-queue(merged in #1031) starts a 16-token streamed chat 1 s into a 1000-token streamed one and requires thesecond to be answered. Both arms stream, so the row cannot see the other half of the same fix — the reviewer of #1031
said so explicitly. A non-streamed request has no way to say "queueing" (no chunk, no comment, no header), so the serve
keeps a short bound for it,
--queue-ms-plain(5000 ms), and answers503 + Retry-After: 1withtype: device_busy.Lemonade's agentic tool loop is exactly such a call site (
src/app/src/renderer/components/panels/LLMChatPanel.tsx:654),which is how the inconsistency was found.
What
chat-npu-queue-plain— the same long streamed chat owns the device; 1 s in, a non-streamed 16-token chat issent. Pass requires: 503, a body that names the device as busy, a numeric
Retry-After, the long chat still ending with[DONE], and no new TDR.plain_queue_verdict()— the pure decision function, with eight--self-testcases: the refusal shape PASSes;being answered while the device is busy FAILs (that would mean the bound did not apply), as do a missing
device_busymarker, a missing or non-numericRetry-After, no status at all, a long chat cut before[DONE], and aTDR during the arm.
bash os/mini/release-check.sh --self-test→release-check self-test PASS.auth_post_watch()— a POST whose status, headers and body are all evidence. The existinggot/got_slowhelpers collapse a status into "did it answer", which is why a refusal was invisible to a row before this.
skip(), so a VM reportsSKIP chat-npu-queue-plainwith its reason.Measured before writing it (one
npu-holdticket,npu-1024-plain, 2026-11-04 18:28:45–18:29:02, 17 s)max_tokens: 1000[DONE]max_tokens: 16, 1 s in{"error":{"message":"the NPU is busy with another request","type":"device_busy"}},Retry-After: 1amdxdnaERROR 0,Array stopped dispatching0.What it can and cannot catch, said rather than implied
The non-streamed bound is unchanged by #1031 (it is main's 5 s bound, kept deliberately), so this row passes on a
pre-#1031 payload as well. Its job is to keep it that way — if someone later points the plain arm at the long queue, this
row goes red instead of a tool-loop call hanging silently — and to make the asymmetry visible in the shipped check rather
than only in
docs/npu.md. It holds the device for the same ~14 s the streamed row already costs.Refs #1024.