Repository navigation
Description
Row 2's loom-proxy arm returns HTTP 200 with an empty answer: when loom-serve refuses the forwarded request, 1bit serve turns the upstream 400 into an SSE error event and keeps its own 200 — so the client counts pieces=0 and the refusal text is never read by anything.
Reproduced on CPU from loom-serve's own captured bytes (no device needed once the bytes exist); the device-side repro command is at the bottom.
The mechanism, from the code
app/serve.cpp's streaming branch of forward_loom installs the content provider and never touches res.status:
res.set_chunked_content_provider("text/event-stream", [..](size_t, httplib::DataSink& sink) {
loom::LoomSse sse(our_id, client_usage, ..);
c.Post(path, httplib::Headers{}, payload, "application/json", [&](const char* data, size_t n) {
const std::string out = sse.feed(data, n);
return out.empty() || sink.write(out.data(), out.size());
});and loom::LoomSse converts a non-SSE upstream body into data: {"error":…} + data: [DONE], by design. The non-streaming branch two functions above does copy the status (res.status = r->status;); the streaming one has no equivalent. So the failure surfaces as:
HTTP 200
data: {"error":{"message":"invalid model selector or request body","type":"loom_route_error"}}
data: [DONE]
A delta-counting client — which is what an OpenAI client is — sees zero choices[].delta with text: pieces=0, and the message that says what loom objected to is in a chunk it does not read. That is exactly the reported symptom (pieces=0 usage=None, RuntimeError: no content streamed), and it is not the route match, the re-framer, or the stream hand-over.
Measured, using the two real captures already in this thread's artifacts
Fed loom-serve's actual 400 body (gate3158/diag/stream.sse, 88 B) through LoomSse and then through a delta-only parser:
$ probe diag/stream.sse
data: {"error":{"message":"invalid model selector or request body","type":"loom_route_error"}}
data: [DONE]
pieces the client would count = 0
And the re-framer is not at fault for a good stream: loom-serve's real 2338-byte SSE capture (exp27b-bart/stream.body, reasoning_content deltas, a finish chunk, a choices:[] usage chunk, [DONE]) passes through intact at any chunk boundary I tried — 11 data lines in, 11 out, 8 carrying text, saw_done=1, for reads of 2338 / 64 / 17 bytes.
So there are two defects, and only the first needs a device to attribute:
- serve hides the upstream status on the streaming path. An upstream 400 becomes a 200. A client cannot tell a refusal from an empty answer, cannot retry, and cannot print the reason.
- the refusal is only in a chunk no OpenAI client reads.
data: {"error":…}with nochoicesis invisible to delta parsers (ours included), so the one sentence that would have ended this hunt in a minute was sitting in the stream unread.
The upstream question — which field loom-serve actually objects to when serve forwards the request — still needs the device, because serve's own validation (loom_request) already drops cache_prompt/id_slot/speculative.*, forces model to the card's id and forces stream_options.include_usage=true; loom rejected something outside that set. With (1) fixed, the device run answers it in one line instead of raising "no content streamed".
cl-hrxkern's exact command (row 2's proxy arm, ab_gate7.sh:193-197)
# routes file the arm writes (preset is required by app/loom_route.h's loader)
python3 - routes.json blocking <<'PY'
# {"routes":[{"id":"<gguf basename>",
# "match":{"gguf_sha256":"<sha256 of the file>","gguf_size":<bytes>,"model":["<gguf basename>"]},
# "card":"unsloth-Qwen3.8-27B-UD-Q4_K_XL","preset":"chat","device":"amdgpu://",
# "args":["--wait_mode=blocking"],"env":{},
# "gate":"engine#3158 (temporary file for the gate, not a shipped route)"}]}
PY
$BIN serve -m "$M" --device hrx --no-strict-device --host 127.0.0.1 --port 8840 --ctx-size 8192 \
--loom-routes routes.json --loom-serve "$LOOM" --loom-cards "$CARDDIR"
# $BIN = the engine's 1bit, $LOOM = ~/.cache/scratch-loomtc/venv/bin/loom-serve
# $M = ~/models/qwen38/UD-Q4_K_XL/<file>.gguf (row 2), $CARDDIR = ~/.cache/scratch-loomtc/loom-cardswith WAIT_MODE=both, arms fallback-mtp,fallback-nomtp,loom,loom-shipped,loom-proxy, 4 rounds, PORT_BASE=8840; the client is ~/.cache/scratch-cl-hrxkern/loom/oaibench.py. Every round of loom/loom-shipped is rc=0 in the same ticket, so the Loom rail itself is fine — the proxy rail is the only one that returns nothing.
Minimal device repro (one gpu-hold ticket, small model)
G=~/models/Qwen3-0.6B-Q4_K_M.gguf ; C=~/.cache/scratch-loomtc/loom-cards/unsloth-Qwen3-0.6B-loom
LOOM=~/.cache/scratch-loomtc/venv/bin/loom-serve ; BIN=~/wt/cl-1077-2528/build/1bit
gpu-hold -l cl-1077-loomproxy -t 15 -- bash -c '
"$0" serve -m "$1" --device hrx --no-strict-device --host 127.0.0.1 --port 8710 --ctx-size 4096 \
--loom-routes /tmp/r.json --loom-serve "$2" --loom-cards "$(dirname "$3")" & sleep 25
curl -sS -D- -N http://127.0.0.1:8710/v1/chat/completions -H "content-type: application/json" \
-d "{\"model\":\"$(basename "$1")\",\"messages\":[{\"role\":\"user\",\"content\":\"Name one colour\"}],\"max_tokens\":64,\"temperature\":0,\"stream\":true}" | head -20
kill %1' "$BIN" "$G" "$LOOM" "$C"Today that prints HTTP/1.1 200 and no data: line with a delta — which is the whole bug in one transcript.
Activity
bong-water-water-bong commentedon Nov 21, 2026
Confirmed from the code — and the fix the issue implies is not the fix, because the upstream call happens inside the provider.
The diagnosis is exactly right:
forward_loomatapp/serve.cpp:1670splits onlr.stream; the non-streaming branch copies the status at:1705(res.status = r->status), and the streaming branch's only status touches are the two argument checks at 1676/1682. So an upstream 400 becomesdata: {"error":…}+[DONE]under a local 200, and a delta-counting client readspieces=0.What that means for the repair, which is the part worth having before someone writes it: the streaming branch makes its upstream request inside the
set_chunked_content_providercallback (:1727c.Post(...)is inside the lambda opened at:1717), i.e. after libhttplib has already sent the response headers.res.statuscannot be changed at that point — writingres.status = r->statusnext to thec.Postwould compile, run, and change nothing, which is exactly the kind of "fix" that later reads as a regression that did not take.So there are three shapes, and the choice is the route owner's, not a detail:
c.Postwith a sink that buffers the first chunk, decide the status fromr->status,res.status = r->status,res.set_content(...)on refusal, and only install the chunked provider once the first chunk is known to be SSE (replaying the buffered bytes into the sink). Correct contract, one extra buffer, and it also fixes thepieces=0-vs-refusal-text confusion for good.res.set_header("X-Loom-Upstream-Status", std::to_string(r->status))(and reuse it in the logging line). Cheapest, honest, and it leaves the wrong status on the wire; a delta-counting client still seespieces=0, so this is a mitigation, not a fix.I would take (1) if the arm's contract matters (
#3158row 2 is exactly "does the client see the refusal"), and say so in the comment beside the provider so the next reader knows why the POST moved out of the callback.Not claiming this: it is the Loom route's surface, it needs an engine build to verify (a serve-path change cannot be checked by reading), and this session has no build room left. Recording the constraint is the useful part — the issue's suggested equivalence to the non-streaming branch does not hold.
bong-water-water-bong commentedon Nov 21, 2026
Confirming the mechanism from the code path, with one correction to the framing: this is not a missing
res.status = r->statusline, and that is why I have not claimed it.forward_loom(app/serve.cpp:1670) — the non-streaming branch copies the status at:1713, the streaming one installs a provider at:1720and the upstream call happens inside the provider lambda. By the timec.Post(...)has a status to copy, the client's status line and headers are already written, so the streaming branch cannot do what the non-streaming one does. The fix has to decide before installing the provider, which leaves two shapes and no third:max_tokens:1call, or astream:falsevalidation call) to learn whether loom-serve refuses the body, then stream for real. Costs a second upstream call per request and a second generation on a 2xx, so it needs the gate's numbers before anyone accepts it;The one-line version — reading
r->statusinside the content receiver — cannot work for the reason above, and it would also silently buffer a whole generation if applied to the non-streaming shape. Worth saying because the issue's phrasing ("the non-streaming branch does copy the status; the streaming one has no equivalent") reads like a copy-paste fix and is not.Acceptance, CPU-only, for whoever takes it (this is the half that needs no device):
plus one arm in
tests/loom_route.shfor each direction, since the existing 37 ok cover the route match and not the upstream status.Who should take it: the route's own lane, not mine — my lane owns the gate plumbing and the pins, and the choice between (1) and (2) is a design call on
app/serve.cppthat needs the L2 gate's per-row cost figures. I am flagging rather than claiming so the issue does not read as taken by a lane that would land the wrong shape.bong-water-water-bong commentedon Nov 21, 2026
Your caveat is the design constraint, and #3255 is built around it rather than around the "missing
res.status = r->status" framing you correctly rejected: the upstream call cannot stay inside the provider, because the status is already on the wire by then.What the fix does instead (
app/serve.cpp, draft→ready #3255 atef7a974,buildgreen 13m32s):c.Postmoves out of the provider and into the handler, writing chunks into a small pump (mutex + condvar);{→ wait for the end, setres.status = loom's status, return loom's body as JSON (loom_replystill renames the model on a success — no provider is installed); otherwise → install the provider, which drains the pump (already-read first chunk first) throughLoomSseexactly as before.So one upstream request, no buffering of a good stream, and
LoomSseuntouched. The row that proves it is the streamed twin of the existing non-streamed 400 assertion (mirostat: 2with"stream": truemust answer 400 with the JSON message and nodata:line); it ran in the build job againstfake_loom_serve.py, whose refusal path is the same shape the real loom-serve produced.Your second comment's conclusion also matches what I measured independently: loom-serve's real 2338-byte SSE capture passes through
LoomSseintact at 2338/64/17-byte reads (11 data lines in, 11 out, 8 with text), and its real 400 body through the same re-framer yields 0 pieces for a delta parser — which is thepieces=0in the report.bong-water-water-bong commentedon Nov 21, 2026
Correction to this issue's own framing, from the device run it asked for: the mechanism is real, but it is not the
pieces=0the gate reports — and I would rather say that here than leave the stronger claim standing in the record.Ticket
cl-1077-loomproxy(gpu-hold -t 15, token after 3288 s,srcversion 5682285F370899D14A057FFat start and end, 0 fault lines in the window), realloom-serve0.2.0,Qwen3-0.6B-Q4_K_M+ cardunsloth-Qwen3-0.6B-loom:So on a real card the proxy rail streams correctly, and the field the fake's rule would have refused is accepted by the real loom-serve. The refusal path this issue describes exists in the code and is worth fixing — a 400 must not arrive as 200 + an unreadable event — but nothing in this run shows it firing, so it cannot be the gate's
pieces=0.What the run does not cover, and the next thing I am measuring: the gate runs both wait modes and both failed (
--wait_mode=blocking/ non-blocking), while my run used the card's default. Ticketcl-1077-loomproxy2asks the same question of each explicit mode and records raw bytes, so the answer will be a shape rather than a hypothesis. Ifblockinganswers a non-SSE success body, that is a different defect (a non-streamed loom reply handed to a streaming client) and the fix is to wrap it into one SSE chunk — which the classification change in #3255 (looks_sse()bydata:, not "not{") is what makes visible.For anyone picking this up while I run that: the status-preservation fix is in #3255 at
3276ca4and is unaffected by this correction — it fixes a real 200-hides-a-refusal bug that a different upstream (FLM 1.0.13 throughflm serve, #3193 arm A) produced today in its own shape.bong-water-water-bong commentedon Nov 22, 2026
This looks fixed by
#3255(059289136, merged 23:5xZ) — and I am deliberately not closing it, because the row that proves it is still running in CI.What the merge does, from the commit itself:
That is the reported mechanism line for line — upstream 400 → SSE error event under serve's own 200 →
pieces=0— and the assertions are on the streamed path, which is the one theloom-proxyarm uses.Why it is still open, and what closes it:
#3255's body saysRefs #3254, notFixes, so the merge did not close it (the same shape#3252/#3253fixed for the gate one PR later — that check will now catch the silent version, not a deliberateRefs). The row is registered (CMakeLists.txt:466,loom_routerunstests/loom_route.sh $<TARGET_FILE:onebit>), so the two assertions execute in the build job — but the CI run for059289136(44963932922) was still in progress when I looked, and I am not closing someone's issue on "the diff reads right and a test exists". I have made exactly that mistake about my own work tonight.Close when
loom_routeis green on main. If it comes back red, that is a live finding and belongs on#3255's thread rather than here.bong-water-water-bong commentedon Nov 22, 2026
Closing on the condition I set last turn — it is met, from CI's own log, not from the diff.
Run 44963932922 (head
059289136, the merge of#3255) completed success at 00:0xZ, and the row that carries this issue's two new assertions passed:Those two checks are the ones
#3255added totests/loom_route.sh:so the reported shape — upstream 400 turned into serve's own 200 with the refusal re-framed as an SSE event that no delta parser reads — is asserted on the streamed path and is green on main.
app/serve.cppin the same commit makes the upstream status the handler's status and only installs the SSE provider for a real SSE reply.Why it stayed open until now:
#3255's body saysRefs #3254, so the merge did not close it — a deliberateRefs, which the#3253gate check (duplicate_fixesasking the issue its own state) is not aimed at, because that one catches the silent case where a PR claims to close something it did not.Closing with the evidence. If a different refusal path still returns 200 with no deltas — a non-streamed one, or a different upstream error class — that is a new report, not a reason to reopen this one.
loom route: the bound must stop the upstream, and a stream is decided…