Skip to content

train 1117162603: #3525 #3363 #3008 #3100 #3151 #3166 #3679 #3699 #3051 (CI only) - #3714

Closed
ashhart wants to merge 31 commits into
mainfrom
lead/train-1117162603
Closed

ashhart wants to merge 31 commits into
mainfrom
lead/train-1117162603

Conversation

@ashhart

@ashhart ashhart commented Nov 17, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #3525 #3363 #3008 #3100 #3151 #3166 #3679 #3699 #3051 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.

ashhart and others added 30 commits November 17, 2026 16:26
…the refs naming it and the blobs only it links to

It lists each snapshot and the bytes freed, then asks on a terminal; --yes skips the question, --dry-run only lists,
and without a terminal it refuses unless --yes. It takes only a cached repo id, deletes only inside that repo's cache
folder, never follows a link out of it, and refuses a repo folder that is itself a link. Hard links and copies count
once per file, so a Windows cache without symlinks frees what it reports. pull's revision check moves to hub.zig so
rm accepts the same refs and commits.
Creating a ticket emits ticket:update from the main process before
the create reply resolves, so the broadcast inserts the ticket via
applyTicketUpdate while createTicket is still awaiting. createTicket
then prepended the same id a second time without deduping, showing
two identical boxes in Todo until restart reloaded the single
persisted copy. Dedupe by id on prepend, like applyTicketUpdate.

Adds a regression test reproducing the broadcast-then-reply
interleaving (issue #3338).

Fixes #3338
An image conversation's kept state is never queued for disk (its rows depend on the image, not just the
tokens). rows_write.queued returned silently; it now logs "kept RAM-only (ImageConversation)" with the token
count, so a disk store that never sees those turns says why. No prompt text or image content is logged.

rows_image_note_test.zig covers both writers and all three image forms (an image, a family frame, an image
placeholder token): the state stays in RAM, nothing is queued or gathered, one notice.

The notice half of 9ca81db, out of #2755; its test lived in that PR's rows_expiry_test.zig, which main
does not have, so it has its own file here.
Each keep of an image conversation logged the notice again. An entry now carries image_noted: a keep whose
prompt extends a noted entry's exact tokens, with the same image identities (cache_images.matches), inherits
it, and queued() logs only for an entry not yet noted. The flag is read at keep, before the new entry can
evict the one it extends, so the notice survives that eviction.

The test adds a later mark and its repeated warm keep with the store held to one entry (one notice in all),
then a changed token prefix with the same image (a second notice).

2de4318 from #2755, on main: Entry's initializer keeps main's seen field, and the test lands in
rows_image_note_test.zig.
An optional library is tried last by its file name alone. On macOS dlopen searches the working directory
for such a name, and on Windows the default DLL search includes it, so a library planted where the server
is started was loaded. On macOS a bare name is now resolved to full paths first: DYLD_LIBRARY_PATH's
folders, then DYLD_FALLBACK_LIBRARY_PATH's or /usr/local/lib and /usr/lib. On Windows the process takes
the working directory out of its DLL search before its first load, for a name and for what a DLL imports.
PATH on Windows and the system loader's search on Linux are unchanged.
…3 fake opens its stand-ins through the loader type
…re at one form

GLM races its classic and factored NVFP4 expert forms when a build first loads and keeps the winner under a key that
carries the build's hash. The race's window sums can land inside its 1% margin, so the same code built twice can serve
different forms, and a comparison of two builds then carries the form along with the change it measures.

TF_GLM_EXPERT_FORM=classic or factored names the form: rank 0 sets it on every rank before the warm-up, skips the
race, and times the windows and the draft step at that form. A load that times nothing (no drafts, or too little
scratch context) still sends the named form to every rank and logs `glm: expert form (untimed)`; unnamed, such a load
stays on classic as before. The named form ends the cache identity, so its record and the race's never stand in for
each other; unset or blank keeps the race and its key as they were. The startup line keeps its words and puts
(TF_GLM_EXPERT_FORM) right after the form's word, which ends MTP's line. Any other text stops the load by name, as
GLM's other rows do.
…sed at the other

The reuse check in price() moves into reuses(), which price() calls in its
place. The new test keeps a classic record under a classic load's key in a
temporary cache, then shows that a load naming factored finds nothing under
its own key, and that reuses() refuses a record kept at the other named form
while the race and the same form reuse it.
…it on its replies (#3111)

--cors-origin ORIGIN is repeatable (64 at most), takes the exact
http(s)://HOST[:PORT] form --allowed-origin takes, and admits that origin
too. A preflight from a listed origin is answered before keys: 204 with
Access-Control-Allow-Origin echoing it, the API's methods and request
headers and a 600 s max age; another method or header gets 403, and an
unlisted origin gets the origin 403 as before.

The allowed request headers are authorization, x-api-key, content-type,
anthropic-version, anthropic-beta and
anthropic-dangerous-direct-browser-access, plus the x-stainless-*
headers the OpenAI and Anthropic browser SDKs send, which the reply
names lowercased after the fixed list.

Every reply to a listed origin's request, key refusals and SSE streams
included, carries Access-Control-Allow-Origin, and with the flag set
replies carry Vary: Origin. No wildcard and no credentials mode; gated
routes still need a key. Without the flag no reply changes.
…s to (#3111)

POST /apply-template and /v1/apply-template take /tokenize's messages
body (tools, reasoning_effort, chat_template_kwargs,
add_generation_prompt) and reply {"prompt": TEXT}: the ids /tokenize
would return, media expanded, decoded with their special tokens. Nothing
reaches the engine. Both routes are in the inference key scope, like
/tokenize and /detokenize.
…k plan (#3617 step 0)

The chat template's render records where each request message's own output begins: an iteration of a loop over
the message, or one that sets it to a name or passes it to a macro (GLM-5.3 writes a run of tool results in the
first one's iteration), counts only if it writes top-level output (eval.zig Marks; template.renderMarked).
prompt.renderStarts maps those bytes to tokens, keeping a start only where the piece before it encodes to the
request's own ids (message_starts.zig), and prepare returns them as Rendered.message_starts when the prompt cache
or a prefill step can use them. They travel as api.Request.message_starts to lanes.Stream.message_starts.

Nothing reads them yet: Request.chunks, every family's prefill cuts and the cache store's starts are unchanged, so
every reply is token-identical. Raw completions, image prompts, video-replaced text and segment or native
renderers (Kimi, DeepSeek) carry no starts.

Tests: every message of Qwen3.8's and GLM-5.3's own templates, and of Gemma 4, Llama 3 and Nemotron turn formats
(system, user, assistant, two tool turns, all closer than min_chunk), starts at one whose segment holds that
message's text alone; a request's chunk plan is pinned to main's; a raw completion has no starts.
… text (#3617 step 0)

The template's marks for a message now follow captured output (set blocks,
macro bodies, scoped blocks, ~ and + joins) to where that exact string is
written, and are dropped when the string is changed or never written. A
binding made inside a capture no longer marks the iteration, and keyword
macro arguments bind as positional ones do. Message lookup is a hash map.

A byte start is kept only where the tokens before it spell the text before
it exactly, token by token, and the text on each side re-encodes alone to
exactly its ids; a fused unknown or a normalized byte drops it. The cost is
one walk of the ids and one more encode of the text in total.

The checker's chunk test now passes an empty fields object, which
chat.prepare requires.

Request.chunks, family cuts and the prompt cache store are unchanged.
… its text (#3687)

A thinking reply that ended at the model's own end token while its think
block was still open, with no tool call, returned an empty answer on every
route: content "" on chat, a thinking block only on /v1/messages, a
reasoning item only on /v1/responses.

After the engine finishes, when the block never closed, the model ended
the reply itself (not a stop string, max_tokens or the loop guard), the
text holds no call opener and no call the route's tool parser reads, and
the request forced no tool and no structured output, the text is also the
answer. It stays in the reasoning field, so the stream sends it as one
content delta at the end and the joined deltas equal the finished reply.
The reply says tensorfold.reasoning_recovered: true, the server logs one
line, and logprobs keep those tokens under reasoning_content. Token ids,
token_sha256 and token counts are unchanged. Kimi's native parse reports
whether its think channel is still open.

Server goldens: the fake model's thinking replies end at their end token
in a block they never close, so 42 golden files (46 replies) and one
request-log line now carry the answer; each difference was reviewed to be
only that (content, the runtime flag, one more stream content chunk, and
the next turn's prompt count in a stored Responses chain).
@ashhart

ashhart commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

Stopped at #3051.

@ashhart ashhart closed this Nov 17, 2026
@ashhart
ashhart deleted the lead/train-1117162603 branch November 17, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants