Without the identity wall, the engine's key is the port's one gate (README), and a
request without it still had its body read whole and, when large, counted by the
engine on the proxy's own key before the engine's 401. The proxy now applies the
engine's own rule first (measured on the live engine: bearer in any case, one space,
the key exactly) and answers the engine's own 401, before the body and before an
Expect: 100-continue invitation; /health and /metrics stay open. The test harnesses
decide which key their proxy holds, whatever HOME holds: those that give it one
present it, as every real client does, and those whose clients send none give it
none (the CI's offline step gives HOME a key). The cockpit knows the new outcome.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SGLang sends a stream's status and headers with its first chunk, after
the queue and the prefill (_handle_streaming_request, in the images of
both lanes). The proxy relayed them when they came, wrote nothing
before, and did not watch the caller of a stream meanwhile. With eight
agents whose contexts outgrew the KV pool (2026-10-03), requests waited
past opencode's 300 s for headers; opencode gave up and sent them again,
and every request it gave up on stayed queued in the engine until its
turn, had its prompt computed for nobody and was aborted at the proxy's
first write: 704 in a night, 163 requests in the queue at the end.
Until the engine answers, the caller of a stream is now watched as the
caller of a non-streamed answer was (that watch's ending is shared, as
_end_upstream): its leaving aborts the request by rid where the engine
allows it and closes the upstream, which SGLang sees within 4 s. Past
KEEPALIVE_S from the request going out, the stream is opened (200 and
its headers, as a hold opens it) and role 1's keepalives go into it;
past MAX_SILENCE_S without the engine's first byte the request is
dropped, as a silent stream is. A quick answer stays the relay's,
headers and status included.
tests/test_proxy_engine_withholds_headers.py: 10 tests against a fake
engine that holds its headers back as SGLang does; 7 fail on v6.30.
Measured with the real opencode 1.18.32 and on the flash lane: see the
CHANGELOG entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>