Commit Graph
37 Commits
Author SHA1 Message Date
Hasan BasbunarandClaude Opus 5.5 1b66a453bc v1.51: the proxy says the box transcribes speech while the NVIDIA Nemotron Transcribe lane serves (v6.59)
The lane holds the GPU instead of a text engine, as the image and video lanes do, and a text engine does not come back
from that by itself: a text request then read "It is stopped, restarting or still loading (about 9 minutes)". It now
reads that the box is transcribing speech (qwen38-transcribe.service) and the way back, as v6.22 and v6.58 say it of
the image lanes. Nothing reaches the lane through the proxy: it answers its own audio routes on its own port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 15:38:53 +01:00
Hasan BasbunarandClaude Opus 5.5 4eda8de142 WIP v1.49: the MiniMax-H3-Image lane: its installer, its unit, its switch, install.sh's flags and every lane list
A lane of its own beside Qwen-Image 2.1 (decisions 1288 and 1374): install-image-h3.sh (venv, the
sglang[diffusion] 0.5.23 wheel, SGLang main at 49f1a44 over it, flash-attn-4 4.0.0b38 and FlashInfer
0.7.2's cubins and jit-cache package by sha256, as SGLang's DGX Spark recipe), qwen38-image-h3.service on
:30026, loopback only, with --sleep-on-idle and --http-graceful-shutdown-timeout 5 (the runtime's own
flags at this commit, where the image and video lanes need patches), its text encoder MiniMax-H3's at
the video lane's pin. On demand like every lane (--with-image-h3, --no-image-h3), the switch, prepare
and uninstall, every unit's Conflicts= and After=, the proxy (v6.57: the box serves images while either
image lane serves), the CI's lists, and the tests that hold each list to lane_registry.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:43:15 +01:00
Hasan BasbunarandClaude Fable 5.2 b79492502a v1.48.0: what the lane's code review found: prompts counted on llama.cpp, the start guard, the effort "none"
A code review of the branch found seven things. Six hold and are fixed,
each with a test that fails on the code before.

The proxy asked llama-server's /tokenize for a count it does not give
(it reads "content" alone and answers the tokens): no body was counted
on this lane, its size decided at one token a byte, and every chat body
past 241,172 bytes was refused. A chat is now counted by llama-server's
own count route, a prompt by /tokenize's content.

The pool the proxy read was one slot's window where the unit holds two:
it is the windows of all the slots (/props), so the flash ceiling of
250,000 holds again, and it is lifted past a window of 262,144, as on
the FP4-Local lane (the 1M option was cut at 250,000).

engine-preflight.sh, which every lane runs before it starts, counted any
llama-server on the GPU as what is left of an engine: one of the user's
own would have held every lane's start back. Only a llama-server in this
lane's container counts.

A reasoning effort of "none" in chat_template_kwargs reached the patched
template, which refuses it: it becomes enable_thinking false, as on the
other Qwen lanes. gguf-fetch.py keeps the Hugging Face token on a
redirect that stays on the same host. The installer refuses a leading
zero in its numbers (0262144 was read in octal and rendered -c 182472).

bench.sh keeps the first pass of each probe on this lane: the second
finds the first's answer in the n-gram pool (36.0 then 273.4 tok/s).

The quality measured on 2026-11-12 is written (GSM8K 0.984 on 250,
HumanEval 0.994 on 164, 20 tool calls of 20), and the 1M option (YaRN at
four times, the KV cache in q8_0, one request): three codes of three
found in 985,296 tokens.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:10:09 +01:00
Hasan BasbunarandClaude Opus 5.5 2c7d4f61da tests/localports.py: what the second review found, no wrappers
_end() walked the tree under a process it might already have reaped, and
a pid used again by then would have had another program's children
signalled, on a box that runs other work: a server is the process start()
returns now, a wrapper execs it, and only that process is ended. With no
tree walk, a wrapper's child is no longer left running, and a poll reads
the process's own sockets first, the machine's tables only when it has
one. A server that listens on two ports is refused, since which one is
meant cannot be guessed, and one that ends before it listens says what
it wrote on its stderr when start() kept it in a pipe. serve() looked at
every listener of the machine, IPv6-only ones included, which cannot
take an IPv4 port: it reads the IPv4 ones on 127.0.0.1 or any. held()
returns the port alone, the test's cleanup keeping the socket. The
witness that a closed port was anyone's could itself be beaten to it:
the guard's failure on the old tree is the witness.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 11:51:55 +01:00
Hasan BasbunarandClaude Opus 5.5 8bb32a2d17 tests: the port a test starts a server on stays its own beside the other jobs
ci-local.sh runs the six jobs side by side on one machine, and three of
them run the same test files. Eleven files took a port number out of a
socket they then closed, to start a proxy on it or to have a port where
nothing listens. Anyone could be handed that port before the server bound
it: a stranger could then answer in its place, and a dead port could come
alive. run_suite.py ran those files one at a time, which kept them apart
inside the suite job and not from the other jobs (code review,
2026-10-28, never seen in three runs).

tests/localports.py gives three answers. held() keeps a port bound and
never listening: a connection to it is refused and no other program can
bind it. serve() starts a server of the test's process on a held port,
beside the socket that keeps it (SO_REUSEPORT), so an engine that stops
and starts again keeps its port in between. spawn() starts a proxy in a
process of its own and keeps it once the socket listening on its port is
its own, read in /proc, else starts it again on another port. The
certificate test passes port 0, since nobody connects to a proxy that
refuses to start, and now checks that the refusal is the certificate's.

test_localports.py proves each answer on the machine, and fails on a test
file that takes a port the old way: on the tree before this commit it
names the eleven. With none left, the suite runs them four at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 11:51:55 +01:00
Hasan BasbunarandClaude Opus 5.5 9acaedd714 keepalive-proxy.py v6.44: the corruption tripwire reads vLLM's reasoning
vLLM streams the thinking as delta.reasoning, SGLang as reasoning_content,
and the tripwire read content and reasoning_content only. On the Flash
FP4-Local lane, a Qwen lane on vLLM whose token id 0 is "!", a decode that
lost its state while it reasoned went unseen (found in review, 2026-10-20).
The guard reads reasoning too. The test fails on v6.43.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 20:15:19 +02:00
Hasan BasbunarandClaude Opus 5.5 37b0113159 proxy unit: MemoryMax holds the bodies it accepts
BODY_BUDGET_BYTES (384 MiB) bounds the bytes of the bodies in flight,
but a body costs the proxy about four times its bytes while the guards
work on it: the reasoning_effort route parses it and writes it again.
Measured on the reference box (aarch64, Python 3.12), on the proxy as a
process with the shape tests/test_proxy_memory_ceiling.py sends (an
image as base64, reasoning_effort "lean"), three runs each: 3.99 times
a 24 MiB body, 4.01 times a 250 MiB one; one body of 250 MiB, under
MAX_BODY_BYTES, took the proxy from 31 to 1033 MiB, past the unit's
MemoryMax=1G with MemorySwapMax=0, where the kernel kills the proxy
with every stream in flight (seen in a cloud container under systemd
255; the client got an empty reply). The proxy of v1.36.2 measured the
same. MemoryMax is 2G now, which holds the budget at that rate with a
tenth to spare; the limits clients see are unchanged.

tests/test_proxy_memory_ceiling.py measures the rate on the machine it
runs on and fails when the idle proxy plus the budget at that rate is
over nine tenths of MemoryMax. The ceiling test of v1.22.13 asks for 2G,
and the two comments that gave 1G as the current ceiling say it was 1G
then.

Found in a cloud review of v1.36.1 (pull request #52). On the reference
box the unit rendered from this commit holds MemoryMax=2147483648 and
MemorySwapMax=0 with the sandbox of the commit before, and every client
above answered through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 20:28:35 +02:00
Hasan BasbunarandClaude Opus 5.5 95e4c87c3e proxy: judge an uncountable body by the bound where a wedge is possible
A body the engine's count routes could not take (native /generate
fields, /v1/responses' input) was judged by the 2.5 bytes a token
average, so a body of digits, one token each, went past the limit
uncounted, into the zone the engine queues and never admits. The native
/generate shape is now counted (ids count themselves, text is a prompt)
and what still cannot be counted is judged by the one byte a token bound
where a wedge is possible; elsewhere the average decides as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 02:11:24 +02:00
Hasan BasbunarandClaude Opus 5.5 fa649a12bf proxy: charge a video its ceiling where a prompt can wedge the engine
The oversize guard charged a video a flat 4,096 tokens, where SGLang's
own video sizing (768 frames, VIDEO_TOTAL_PIXELS) lets one cost about
88,000, and a body of a dozen video URLs is a few kilobytes that the
byte estimate never nominated for a count. Where a wedge is possible,
each video part now adds its ceiling to the nomination and to the count,
so such a body is counted and refused as too long; lanes whose engine
refuses past its own window keep the flat budget and see no change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 02:11:24 +02:00
Hasan BasbunarandClaude Opus 5.5 d83f8c6ea5 proxy v6.37: serve a vLLM lane behind the same door
The Kolibri lane runs vLLM 0.29.0, and four things the proxy assumed of SGLang are not true
there, each measured against the real engine on 2026-10-14:
- no /server_info: the pool is the kv_cache_size_tokens label of /metrics' cache_config_info
  and the window /v1/models' max_model_len (without them every body past 256 KiB was held
  as "not measured yet" for good);
- a model it does not serve is a 404: a body naming another model gets the served one, so a
  client set up for one lane keeps working on this one (SGLang bodies are never touched);
- a closed connection stops the request (no /abort_request): closing replaces draining;
- the vocabulary probe needs the served name and reads vLLM's wording (128,000 tokens).
What was learned of one engine (vocabulary, x-override-rid) is dropped when another names
itself; System One says it needs a Qwen lane. PROXY_HOLD_UNITS names the Kolibri unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 03:10:07 +02:00
Hasan BasbunarandClaude Opus 5.5 8a62ab1028 proxy unit: a memory ceiling of its own, swap included
MemoryMax=1G with MemorySwapMax=0: the highest peak over two weeks of real traffic was
101 MB. On a box with swap, MemoryMax alone moves the excess to swap (measured: a unit
capped at 100M held 300M); with both, the kernel stops the proxy alone and systemd
starts it again 3 s later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:01:57 +02:00
Hasan BasbunarandClaude Opus 5.5 0b27e26d99 proxy: the serving key is checked before a body is read
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>
2026-10-08 15:01:56 +02:00
Hasan BasbunarandClaude Opus 5.5 421ae7dd61 proxy: count the prompts that could wedge the lane, by their bound
Where the engine accepts a prompt past the share of its pool this guard lets through
(the 27B lane: 863,638 accepted, 794,552 usable, measured 2026-10-08), a body is
nominated by its bound, one byte a token, not by the 2.5 average that let digit-heavy
text through uncounted; nothing under 200 kB was looked at, whatever the pool. Where
the engine's window is under that share (the flash lane), it refuses past it itself and
the average nominates as before: counting there was measured at +115 ms for a lone
300 kB prompt and +1.65 s for eight at once. A body the engine cannot count is judged
as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:01:56 +02:00
Hasan BasbunarandClaude Opus 5.5 f9c0fd0729 proxy: refuse token_ids_logprob where the engine reads it
On a batch that mixes a request asking for token_ids_logprob with one that does not,
the served 27B build (v0.5.19) fills a bare list for the one that did not ask and
calls .tolist() on every entry: its scheduler dies (sglang#34719, open). Refused at the
top of a /generate body and in the parameters of /vertex_generate, the only places the
engine reads it; a value the engine treats as absent passes, the OpenAI routes are not
touched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 15:01:56 +02:00
Hasan Basbunar 2f76ef4370 proxy v6.27 + video lane: the review's second pass, verified against the engine
The review's sub-agent reports were each verified by hand against the
installed SGLang before anything was changed; what they got wrong was
dropped.

keepalive-proxy:
- the guards judged the raw JSON value, but the engine's pydantic models
  coerce 999999, "999999" and 999999.0 to the same int before the
  scheduler runs, so a crash shape typed as a string sailed through the
  ceiling and the token-id refusals (_engine_int, checked against the
  installed build field by field);
- /vertex_generate also judged parameters.sampling_params, which the
  scheduler spreads into its SamplingParams (stop_token_ids and n were
  reachable there; top_logprobs_num is not, and the guard does not
  over-refuse it).
- the version moves to v6.27 and says what the second pass found.

dashboard:
- num_inference_steps is bounded server-side on the video lane (1 to 100,
  as the image lane already does) instead of trusting the page's slider;
- the stop message no longer promises a 5 s cut the unit never makes (it
  waits up to 60 min); the curl preview no longer prints a task the
  server refuses;
- the video lock hand-off now carries the timeout with the call that
  timed out instead of re-reading a global a test could already have
  restored; the vacuous download assertion in the async test is now a
  real one.

installers:
- install-image.sh starts the lane that was serving again after its smoke
  test even when that lane was the video or the llamacpp one;
- install-video.sh refuses a VIDEO_BIND=0.0.0.0 that would put a keyless
  generator on every interface.

Every change is held by a test that failed before and passes after; the
full offline suite (proxy, dashboard, installers) and ruff F,E9 are
green.
2026-09-27 03:57:02 +02:00
Hasan Basbunar 630f581862 keepalive-proxy v6.26: close the review's three open guard findings
S4: a key spelled with a JSON \u escape ("\u0074op_logprobs") carried
none of the bytes the guards scanned for, so the ceiling and the token-id
refusals were skipped; any escape in the body now forces the parse.

S5: the sampling and logprob guards also cover /v1/responses, /invocations
and /vertex_generate, read input_ids as a batch of lists, read
sampling_params as a list, read prompt as token ids on /v1/completions,
and the oversize guard reaches /generate and the other non-/v1/
generation routes.

S6: the TLS handshake no longer runs in the accept loop (one silent
connection parked every other client behind its timeout); it now runs in
the connection's own thread on its own budget, and a handshake that dies
leaves one journal line, no traceback.

Each change is held by a test that failed before and passes after; the
full offline suite and ci-local are green.
2026-09-26 21:22:49 +02:00
Hasan Basbunar 5c287e7d1d Merge branch 'worktree-agent-a41077fa2a7fb7b24' into fix/revue-v1.18.6
# Conflicts:
#	tests/test_suite_isolation.py
2026-09-25 12:12:27 +02:00
Hasan BasbunarandClaude Opus 5.5 2f88eff628 CI: ruff sees every script, no test file leaks its environment, one run of each suite less
- ruff F,E9 ran over a hand-kept list that left out engine-inputs.py and oc-merge-limits.py,
  both run by install.sh: the list comes from the tracked .py files now (the vendored
  flash-sglang/ overlay excepted), with a floor. An undefined name in either passed before.
- The isolation test ran one file and compared HOME alone, while four files left UPSTREAM,
  KEEPALIVE_S, CLIENT_IO_S, MAX_SILENCE_S, PROMPT_CEILING_TOKENS or SGLANG_API_KEY set for
  every module after them. Every unittest file now runs in a process of its own (four at
  a time, about 20 s here) and must hand back the whole environment, and the four restore
  what they set when their class is done. A class that moved HOME, or set UPSTREAM, and
  never put it back passed before.
- TheRender in test_lean_level.py needs jinja2, which no step installed: it ran only
  because the runner's python ships it, and without it the lean step reported OK with
  the render skipped. The discovery step installs it, and the TypeSafe SDK.
- 17 steps only re-ran a unittest module the discovery step already runs (combined, then
  each file directly) and the offline step runs again: four runs of each, no assertion
  added. They are gone, with the two installs they carried moved into the discovery step
  (one of them had a name YAML cut at its " #").

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 23:41:00 +02:00
Hasan BasbunarandClaude Opus 5.5 7c9156bb6a proxy tests: three names that promised what their assertions did not check
- "a smaller pool is picked up after invalidation" wrote the new pool into the cache by
  hand after invalidating: it reads through pool_tokens() from a fake /server_info now,
  so an invalidation that drops nothing fails it (it passed on its own before).
- "a deep schema is left untouched and reported" never read the report: the depth-bound
  line must be logged.
- "a non-streamed wall of markers is named" asserted only that the answer arrives: the
  proxy's journal line naming the corruption is read too.
Each mutant (a no-op invalidation, a silent depth bound, a silent corruption check) passed
its test before and fails it now.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 23:28:48 +02:00
Hasan BasbunarandClaude Opus 5.5 9068ef3467 tests: the proxy fixtures hand the proxy its key instead of writing one into HOME
A missing ~/.config/qwen38/api-key used to be written as "test-key" and deleted at
tearDownClass, which a Ctrl-C skips; install.sh keeps a key it finds. The in-process
proxies are handed the key, the proxies run as processes get a HOME of their own, and
test_suite_isolation sets the five fixtures up in an empty HOME and fails if anything
appears there (it fails on the old fixtures).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 18:24:43 +02:00
Hasan BasbunarandClaude Opus 5.5 7e58a19e77 proxy: Anthropic bodies counted by the engine, raw query bytes refused, bounded logging, labelled first lines; cockpit reads the running proxy's banner
- P3: an Anthropic body goes to the engine's own /v1/messages/count_tokens
  (its conversion, tools included), each image priced from its header and
  replaced by an empty text block (an empty list is a 500 there). Measured on
  the box: five screenshots in tool_result blocks were counted 2,044,251 and
  refused, the engine serves 28,463 (28,458 counted now); 8 tools, 422 counted
  before, 2,709 now and served
- P4: a raw control or non-ASCII byte in the query is a 400, not a dropped
  socket and a "client vanished" line
- P5: the logged-once memories keep 16-byte digests, 512 at most; the moved
  effort is printed 40 characters long (five 20 MB values: 22 -> 346 MiB and
  a 20,000,137-character journal line each, before)
- P7: a client named by the identity wall is named on the request's first
  line too, as one word; the cockpit's feed accepts the label after the peer
- P6: the cockpit greps the banner in its current shape ("on 0.0.0.0:30001");
  it showed v6.20 while v6.24 ran. U7: the too-old-to-abort warning compares
  versions part by part, server-side (as floats, v6.2 to v6.9 passed)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 15:25:16 +02:00
Hasan BasbunarandClaude Opus 5.5 b24c6d1f1f Current SGLang routes, pinned image tags, and a summary printed once
- The cockpit asks /v1/loads?include=core (projected to the /get_load shape)
  and /server_info; the keepalive proxy (v6.23) and oc-fit-limits.py ask
  /server_info, conc-check.py /model_info. Each falls back to the deprecated
  route only on a 404. Both SGLang images log a warning per call of the old
  routes: 597 + 20 in ten minutes of the 27B's journal, now none.
- install.sh tags each pinned image present on the box
  (qwen38-pinned:<lane>-<digest>): an untagged digest pull is dangling, and
  docker image prune deleted it. uninstall.sh knows the tag, removes an image
  by all its references, and warns about prune only for an untagged image.
- install-agent.sh's nested install-dashboard.sh run prints only the relay.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 22:25:10 +02:00
Hasan BasbunarandClaude Opus 5.5 22fc07e649 Every lane: the boot bar does not go back, and the proxy names the image lane
A TEXT BOOT THAT FLOODS ITS LOG SENT THE BAR BACK TO THE START. The lifecycle
parses the last 300 lines of the engine's log while health is down. The 27B
boot at 21:50 today logged inductor compile errors during the graph capture
(`LLVM ERROR: Unsupported rounding mode`, caught by inductor, the boot went on
to ready in 426 s; the same noise shows on three of today's eleven boots): 850
lines in all, every milestone out of the window, stage None, and the lane
went from "capturing graphs" back to "starting" for the rest of its boot.
Within one activation the stage now stays the last one the log proved, and a
new activation starts from its own log.

A cockpit that did not watch the boot (restarted in the middle of it, or
after) had nothing to carry, so the start of the boot is read once per
activation, bounded to its first 15 minutes: the container is created at
each start, so those minutes are this boot's own and hold every milestone up
to "fired up". Checked against the live container: start computed at
21:50:58, the unit's own ActiveEnterTimestamp; 850 lines; warming-up, fired
up, both weight loads. The same read fixes a quieter error: a serving engine
that lost health, to a cockpit that had not seen it boot, read "starting"
(its tail is decode lines, stage None) and now reads "degraded". Nothing acts
on that difference (the wedge belt only runs from "ready"); it is what the
page says.

THE PROXY SENT TEXT CLIENTS TO WAIT FOR AN ENGINE THAT WAS NOT COMING
(v6.22). With the box switched to images, the text engine is stopped on
purpose and does not come back by itself, and the proxy answered "stopped,
restarting or still loading (a restart takes minutes, about 9)". The error
path, and only it, now asks systemd whether qwen38-image.service is active,
at most every 5 s, and names the image lane and the way back. Tested against
the real proxy process with a stand-in systemctl in both directions, and
with the real one on the box (inactive: the answer it always gave). Proxy
v6.22 deployed and serving: a real chat completion through :30001 in 0.7 s.

CHANGELOG: a v1.18.0 entry for the image lane, marked unreleased; the date
and the tag belong to the release.

Five collector tests (the flood, a new activation, evidence over memory, the
read-once, degraded not starting) and two proxy tests; the carry-over, the
head read and the proxy message were each undone once and their tests failed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-22 22:03:12 +02:00
Hasan BasbunarandClaude Opus 5 5d6738fd59 install: the engine and the proxy can answer on localhost only (v1.16.0)
Both listened on every interface, and this box shows what that was worth.
Seven days of journal: 581,479 requests to the engine and 8,288 to the proxy,
every single one from 127.0.0.1, while the machine was reached from a laptop
and a phone on the cockpit port alone. Two ports open to a LAN and a tailnet,
used by nobody but the box itself, and they are the two SGLang dies on rather
than refuses (sglang#40076, sglang#31597, refused at the proxy since v1.15.0).
The proxy's guards protect what goes through the proxy; a port that bypasses
it is a door beside the one with the lock.

ENGINE_BIND and PROXY_BIND close them. The defaults do not move: somebody
else's laptop may legitimately point at either port, and a default must never
take away something the operator did not ask to lose. An installed choice wins
over the default in both directions, which is the part that matters, because a
box hardened to localhost that a plain ./install.sh reopened would be the worst
of the three outcomes: nobody would have a reason to look. A bad value is
refused by name before a unit is written, not by a unit that fails to start
minutes later on a box whose engine has just been stopped.

The proxy is v6.21 for it. The version gate added in v1.15.2 earned its place
on the first try: the bind changed the shape of the startup line, the banner
stopped matching the history block, and the test failed before this could ship.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 12:56:29 +02:00
Hasan BasbunarandClaude Opus 5 42a88b43c2 proxy: all three statements of its own version agree, and a gate keeps them agreeing
v1.15.1 fixed the history block and left the startup banner and the module
docstring saying v6.19, so a deployed box printed v6.19 in its journal while
its cockpit read v6.20 from the same file. One fact, three copies, no gate.

The test asserts the three agree and that the history stays newest-first,
because the cockpit reports the first entry it finds. Checked by reverting the
banner and watching it fail, not by reading it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 11:41:44 +02:00
Hasan BasbunarandClaude Opus 5 e16960697c tests: the vocabulary probe's tests asserted the machine, not the guard
Two of them passed here and failed on CI. The probe reads the serving key
before it sends anything, and a runner has no key file: _api_key() raised
inside served_vocab(), the probe never left, and the tests that assert it
probes saw zero calls. They passed locally only because a developer's box
keeps that file.

The key is stubbed now, so they assert the guard. And the case CI exposed is
worth a test of its own rather than a fix: with no readable key the vocabulary
stays unknown, which stands the two id checks down and refuses nothing it
cannot judge, while a negative id is still refused because no vocabulary can
hold one.

Verified the way CI runs it, with the key file moved aside: all six proxy
suites green.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 10:44:44 +02:00
Hasan BasbunarandClaude Opus 5 9d6967687c proxy: refuse the request fields SGLang dies on, and close three holes of this route's own (v6.20)
Reading logprobs is what /v1/systemone does, so an audit went looking at what
else can ask for them. OpenAI documents top_logprobs as "an integer between 0
and 20"; SGLang declares it Optional[int] with no constraint and hands it to
logprobs.topk(max_k), where a number past the vocabulary raises "selected index
k out of range" INSIDE the scheduler. One request from one client ends the
engine for everybody, and this box needs about nine minutes to come back
(sglang#40076, open). It was then reproduced the hard way here, by relaying one
such request during a test of the refusal meant to prevent it.

sglang#31597 catalogued the same family in July with reproductions, and both
PRs that bounded them were closed without being merged, which is why the first
had to be reported again in September. Checked one by one in the served
v0.5.19: stop_token_ids indexes a scatter_add_ out of bounds whenever
min_new_tokens > 0; input_ids indexes the embedding, and the validator that
would stop it has zero callers; n becomes parallel_sample_num unbounded. All
reachable from an ordinary chat request.

So the proxy refuses them, on the three relayed routes that carry the logprob
count under three names, element by element when a batch sends a list. The two
id fields need the vocabulary, which the engine publishes nowhere, so it is
asked for the only way it is offered: an out-of-range logit_bias is refused
with a message that names it. One probe an hour, built to be refused, never
reaching the scheduler; it matched the checkpoint's config.json to the digit.
A negative id is refused whatever happens, and a probe that fails stands the
rest of the guard down rather than refuse traffic it cannot judge.

Three defects of this route's own, found in the same audit and in review:
  * the retry that asks a second, wider time went straight to the engine
    without the door, and ignored SYSTEMONE_TOP_K_MAX, the clamp an operator
    sets because their build refuses a wide top-k
  * a percent-encoded non-ASCII byte in any path decoded to something
    http.client encodes as ASCII, raising UnicodeEncodeError, a ValueError no
    arm here catches: an empty reply and a traceback, before any key is checked
  * a lone surrogate outside the state cost a full fan-out and returned 500;
    the check now runs over the whole parsed request, before any inference, and
    never echoes the text it cannot encode
  * a branch still queued for a slot was aborted with a rid the engine had
    never seen, then sent anyway when a slot freed

And one trap written down rather than fixed, because the code was already right
and nothing said why: on the speculative path this lane runs, the engine
divides the logprobs it returns by the request's temperature, and on the
ordinary path it does not. Only the 1.0 this route sends makes the two agree.

keepalive-proxy.py at 84% branch coverage, floor raised to 83.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 10:22:37 +02:00
Hasan BasbunarandClaude Opus 5 f0034de5ca v1.10.2: the window the model actually has
The flash lane serves 262,144 tokens and opencode was allowed 175,000 of them.
The ceiling that capped it was not wrong, it was stale: it came from the v1.5
engine, whose PLE mapping faulted in whole page-cache folios and made a long
prefill cost ~0.27 GiB per 1k tokens past 90k. v1.8 serves an engine that trims
that, and nobody re-measured.

Measured now, MemAvailable sampled through every prefill, engine up 19 h with
the PLE budget filled: 195,784 tokens cost 1.16 GiB and 94.7 s; 225,051 cost
1.57 GiB and 111.3 s; 249,500 cost 1.52 GiB and 126.1 s with the floor at 6.9
GiB. Needle 3/3 exact at 200,058 / 230,231 / 249,838. Flat past 200k, an order
of magnitude under the v1.5 engine. Memory is no longer what caps this lane;
max_req_input_len (262,138) is.

- The one-prompt ceiling is 250,000, leaving 12,138 tokens under the engine's
  wall. The flash context tier becomes 225,000 / 32,000. Compaction fires at
  205,000 instead of 155,000 and the chain still closes on the measured worst
  step: 225,000 - 20,000 + 43,863 = 248,863 <= 250,000. Verified live: a
  248,796-token prompt served through the proxy in 136 s, one above the ceiling
  still refused with code context_length_exceeded.
- --allow-auto-truncate is gone from the launcher and gated out of every lane.
  It was undocumented. A probe asked for a prompt above the window and got back
  prompt_tokens exactly equal to max_req_input_len with a confident answer, the
  needle gone, and no warning: the engine had quietly cut the context. The proxy
  already refuses above the ceiling, so the flag bought nothing and cost the one
  failure worse than a refusal. Takes effect on the next engine start.
- Compaction stops throwing the window away. opencode's preserve_recent_tokens
  default is min(15000, max(2000, threshold/4)), and that cap was chosen for
  128K models: here a compaction at 205,000 would keep 15,000 and summarise
  190,000. The installed value is a quarter of the threshold (51,000), sized by
  oc-limits.sh --preserve and rewritten by every install and switch, with prune
  on so stale tool output is cleared instead of the conversation summarised.
- A switch now reaches the server that reads the numbers. opencode serve parses
  opencode.json once at startup and never again: with 225,000 on disk the
  running server still answered 175,000 on /config, so every switch left the
  Agent tab compacting against the previous lane's window. install.sh and
  switch-model.sh restart opencode-web.service after the last config write.
- An image the guard cannot parse is charged its geometric ceiling (16,386), not
  the flat budget: a 3840x2160 screenshot really costs 8,162, so the flat 4,096
  under-counted it, which is the direction that lets an oversize prompt through.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-13 13:59:11 +02:00
Hasan BasbunarandClaude Opus 5 dc491d12a6 v1.10.1: an image costs what it costs, and a refusal opencode can act on
The flash lane died mid-session with a proxy 400 whose number was wrong. On
2026-09-12 a conversation was refused as 200,684 prompt tokens against the
lane's 200,000 ceiling; the engine was serving 139,868.

The gap was 24 screenshots. /tokenize returns an image's 3-token placeholder,
not its expansion, so since v6.8 the oversize guard charged every media part a
flat 4,096 tokens. Measured against this engine at twelve sizes, an agent
screenshot costs 880 (1280x720) to 1,562 (1680x950). All eight oversize
refusals this box has logged were sessions holding images.

The guard now prices an image from its own header (PNG, JPEG, GIF, WebP) with
the vision tower's geometry: round(w/32) * round(h/32) cells clamped into the
processor's pixel range, plus two wrapper tokens. Exact against the engine at
all twelve sizes including both clamp branches, and end to end at 1, 5 and 24
images. Every checkpoint this repo serves has the same geometry, so one formula
covers both lanes; TOKENS_PER_MEDIA stays as the fallback for what has no
readable header. Replayed live: the refused conversation now serves at 139,548.

The refusal also became recoverable. opencode answers a context overflow by
compacting and dropping media attachments, which is the right move here, but
only when it recognises the error: a fixed message vocabulary, or error.code ==
"context_length_exceeded". The old message matched nothing and carried no code,
so the session resent the same prompt and got the same 400 (23:18:00 at
200,684, 23:18:03 at 200,735, no compaction between). error.type stays
context_too_long, because needle.sh reads it.

The 175,000 context tier keeps its number and loses its reason. opencode does
not estimate its context: it compacts when the last response's reported usage
reaches limit.input - min(20,000, output cap), from the engine's own numbers.
What it cannot see is the step it is about to take, so the rule is threshold
plus one worst step under the ceiling. Measured over 2,156 flash-lane steps in
opencode's session store: worst step 43,863, p99 18,512. 175,000 gives 198,863
under a 200,000 ceiling; 190,000 gave 213,863. oc-fit-limits derives its margin
from those measurements, and a CI gate holds the invariant and the agreement
between tool and table.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-13 13:24:10 +02:00
Hasan Basbunar d96c1557c6 v1.10.0: measured serving flags, a wildcard-free sudoers file, and a hardened proxy
- proxy v6.15: body cap (413), bad Content-Length (400), warmup hold (503),
  GET deadline, explicit SSE close, depth-bound reports; drains unbounded by design
- sudoers without wildcards (fixed staging, ceiling drop-in, exact journalctl),
  dashboard unit read-only on /etc; NoNewPrivileges=no kept (sudo needs it)
- installer: 0600-born key, numeric ports, HF_CACHE disk check, escaped render,
  loud --from fallback, atomic yarn patch, native offline boot, UNIT_CTX fix
- measured on the box: replayssm-spec adopted (+20% pool), tier 8 validated
  (default stays 4), chunk kept, incoai draft declined, YaRN cache repaired
- tests + CI gates for every fix; full suite 42 ok
2026-09-12 18:17:34 +02:00
Hasan BasbunarandClaude Opus 5 7a874e014f proxy: a tool schema Python's re cannot compile no longer 400s every request (v1.8.3)
Claude Code 2.1.266 could not open a session on this lane: every request came
back 400 "Tool 1 function has invalid 'parameters' schema ... is not a 'regex'".
SGLang validates each tool's parameters with Draft202012Validator.check_schema
(serving_chat.py:868), whose 'regex' format check compiles 'pattern' with
Python's re. JSON Schema says 'pattern' is ECMA-262, which has Unicode property
escapes; re answers "bad escape \p". One tool carrying such a pattern (Claude
Code's Artifact, on its 'field' argument) refuses the whole session.

The proxy (v6.13) removes only the patterns Python cannot compile, only inside
tool parameter schemas (input_schema and function.parameters, request level and
message level). A body carrying none of the JSON-escaped markers \\p{, \\P{, (?<
is forwarded untouched and unparsed, so the hot path pays one substring scan; a
prompt quoting such a regex is never rewritten; the walk is depth-bounded; each
distinct dropped pattern is logged once.

Reproduced against the live lane (400), answered 200 with the same body after
the fix. tests/test_proxy_guard.py grew five cases and runs 30.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 13:39:50 +02:00
Hasan BasbunarandClaude Fable 5.1 a08dea9cd8 flash: the KV pool is the same on every boot, and the cockpit sees it
SGLang sizes the pool from MemAvailable at the instant it profiles (psutil on an
integrated GPU, confirmed in the image), so two boots of the identical launcher
drew 189,056 and 249,408 tokens today, and the bigger draw cost 6 GiB of the
host headroom a 120k prompt spends. The launcher pins --max-total-tokens 190000
(served as 189,952 after page alignment), the envelope every needle and canary
result in this repo was measured in, and waits up to 180 s for MemAvailable to
clear 96 GiB before starting; measured, a stopping lane's memory is back within
one second of the container exit, so the wait costs nothing on a normal switch.

Verified on the reference box after the change: pool 189,952, idle 23.7 GiB,
needle 2/2 at 120k with a 14.9 GiB floor, canaries 4/4, and _qsa_split_kernel
(KDA) is the only QSA kernel compiled in the container: the Triton fallback was
never called.

The cockpit recorded one boot in five because it read the engine_info cache at
the ready transition, which then holds the boot's connection errors or the
previous engine's facts; it reads the engine directly now, and says when a pool
comes up short of its pin. The recipe parser drops full-line comments, since a
comment naming a flag was parsed as the flag. Proxy v6.12 trips at 128 marker
characters and ends the OpenAI stream with [DONE]. The v1.6 and v1.6.1 release
notes were republished whole.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 22:10:01 +02:00
Hasan BasbunarandClaude Opus 5 764c8107ab proxy v6.11: a wall of exclamation marks is not an answer
When the decode path loses its state on this hardware it does not stop, it
emits runs of token id 0, which is "!" in the Qwen tokenizer. The client reads
that as the answer. It is the visible face of sglang#36537 / #36558 / #36806 /
#36845 and the reason the flash lane is still beta.

The proxy now counts marker characters across the stream and, past
CORRUPTION_RUN of them in a row (48 by default, 0 disables), aborts the
generation upstream and sends the client an explicit corrupted_output error in
its own dialect. It reads only the delta text it already relays, never
tool-call arguments, so prose with "!!!" in it is untouched; a non-streamed
answer cannot be withheld once it is on the wire, so there the guard names it
in the log instead.

Nine unit tests on the run counter and the dialect readers, plus an end-to-end
test whose fake engine streams 4,000 exclamation marks: the stream is cut, the
client gets corrupted_output, and /abort_request is called with the right rid.
Verified live on the reference box: v6.11 serving, a normal answer containing
"bravo!!!" relayed untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UXuj8DiygLTBQPxfVSWrgM
2026-09-03 18:52:04 +02:00
Hasan BasbunarandClaude Opus 5 bc1e00c733 fix: the proxy stops enforcing a dead engine's KV pool
pool_tokens() cached the KV pool for 600 seconds and never dropped it. Nothing
invalidated the cache on an engine restart, so for up to ten minutes the
oversize guard enforced the limit of an engine that was gone.

That matters because the pool is not a constant. It is a boot lottery for one
checkpoint (863,398, 893,479 and 913,334 measured here) and it changes outright
between lanes: about 863k on the 27B lane against 184k on flash. A prompt
accepted against a stale larger pool and relayed to a smaller engine is exactly
the case v1.5.4 added this guard for, where the scheduler busy-loops forever
with /health still answering.

The cache is now dropped whenever the engine proves unreachable (both 503 paths)
and whenever a refresh read fails, since a failed read is itself evidence the
engine moved. Three tests cover it, and the one that matters goes red when the
invalidation is removed: I checked by putting the bug back.

Tests: tests/test_proxy_guard.py 15 ok (12 before), ./ci-local.sh 20 ok.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BxM8C7oTYmxJsXAqHfV6nb
2026-09-02 23:52:18 +02:00
Hasan Basbunar 419bb111cf proxy v6.9: a down engine answers 503 engine_unavailable, never a false context_too_long (v1.5.8)
Field case 2026-08-30 01:15: the flash engine restarted after a GPU fault (Xid 31,
illegal memory access in the QSA indexer prefill) and the oversize guard, unable to
reach /tokenize, refused a 68,626-token request as 'at least ~408841 tokens by size'.
Now every path answers 503 with Retry-After and a message that says the request was
not refused for its size; upstream 5xx (SGLang while starting) gets the same message.
Tests: connection refused, 5xx, 4xx, and the real proxy in front of a fake loading engine.
2026-08-30 01:45:35 +02:00
hasso5703andClaude Fable 5 7f2b3fd09b proxy: absolute per-lane prompt ceiling (PROMPT_CEILING_TOKENS), flash 135000 by default
The KV pool is not the limit on the flash lane: the prefill of a long prompt grows
the engine's footprint by ~0.27 GiB per 1k tokens beyond ~90k on a 128 GB box
(measured 29/08 at fraction 0.81: 120k +7.4 GiB, 135k +11.4, 150k +15.3 with
the first driver allocation refusals, 177k +22.8 with MemAvailable at 0.8 GiB and
15 NVRM out-of-memory kernel lines). The proxy now caps one prompt at a token
count set per lane by install.sh through the keepalive unit (flash 135000, the
largest clean point; 27B unset), on top of the pool share. CI renders the new
placeholder; 9 proxy tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-29 20:14:19 +02:00
hasso5703andClaude Fable 5 09060b661d keepalive proxy v6.8: the oversize guard counts with the engine tokenizer
The v6.7 guard divided the body size by 2.5 chars per token and refused
everything above the KV pool. English prose runs 3.4 to 4.6 chars per token,
so a 140k-token prompt (479 KB) was refused as 192k tokens although the pool
served it (measured in the 29/08 soak: 60k, 100k, 120k looped fine, 140k got
400 every time). Now the size only nominates a body; the engine's /tokenize
(present in both images this repo ships, 644 ms for 474k chars) gives the exact
prompt length, chat template applied, Anthropic bodies converted, media parts
counted as a fixed 4096-token budget instead of their base64 text. Refusal
above 92 percent of the pool (OVERSIZE_MARGIN_FRAC, the README's 165K of
178,560); size-based refusal stays as the fallback when the engine cannot count.
8 offline tests with a fake /tokenize, wired into CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-29 19:01:17 +02:00