You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
server: a refused handover's 409 comes from a typed failure code, not the message text (#2349, after #5729) - #6239
Three review fixes held back from #5729, which is now merged. One behaviour changes:
Before: the server answered 409 handover_not_loaded for any failed reply whose message starts with handover_not_loaded. A completion with no handover got that 409 if its engine's failure text started the same way.
After: when the lane host refuses a handover it sets failure_code = .handover_not_loaded on the failed finished event, and the server maps the 409 from that code. The message text is unchanged and no longer decides the status.
Commits:
0f62b9378, test only: --handover and --learn-daily-gib 2.5 parse the same in either order (handover_cli_test.zig).
0acc63819, test only: a populated scoped store shares the prompt-cache budget and sheds under a memory-pressure warning (lane_host_pressure_test.zig).
b93b3e32d, the fix: FailureCode in engine_api.zig. lane_host.zig sets it in finish and gains dropHandover, which the three refusals in lane_stream.zig call. mailbox.zig carries it. chat_generation.zig reads it in place of std.mem.startsWith. It adds one test (completion_prompt_test.zig), re-pins lane_host.zig in zig/tests/fixtures/gradient-serving.tsv (the row's note cites Team Drift step 1: hand a kept prompt state to another session of the same model (#2349) #5729, because this pull request had no number yet) and registers the step test-handover-review-host.
Commits 1 and 2 add tests for behaviour main already has and change no source file. They were run on this head only. Commit 3's test is the one that fails before the change.
Stacked on: main 1f437b986, the three commits above. Main has since moved to e0675feb5 (33 commits, 3 Dec 19:28Z). Of the files this change touches it changed only the pin fixture, in other rows, and git merge-tree of the two is clean. The branch is not rebased yet, so every check below is on 1f437b986.
Manual check of what ATC did not cover (gh file lists and git merge-tree against all 398 open pull requests, 3 Dec 19:12Z): 132 share a file with this branch, 81 of them only the pin fixture. 22 merge clean, 21 conflict only in files this change does not touch, and 86 keep the conflict blocks they already have against main. These commits add conflict blocks with three. None is resolved yet. Each is two additions at the same place, for whichever lands second to resolve:
Lean checker, on the base and on this head, run through python3 tools/pr_check.py --base upstream/main: 88 and 88, 0 new. 0 errors, 3 advisory warnings: two inherited import cycles, and the Unreleased line, which it cannot check without a pull request number.
Tests run, with the command and pass, fail and skip counts, on macOS arm64 with Zig 0.17.0:
Fail before, pass after: on main 1f437b986 with only commit 3's change to completion_prompt_test.zig applied, zig build -j2 test-server-cpu --test-timeout 30m --summary all fails in that one test, "handover-like engine text never changes an ordinary completion failure status", with expected 500, found 409 (10/12 steps, 2312/2338 pass, 25 skipped, 1 failed). On this head the same step passes. The tests of commits 1 and 2 were run on this head only.
CI: no run on this head yet.
Not run, and why:
Full zig build test and test-golden: not run for this follow-up. The steps above are the lane host module's whole suite, the server module's whole suite and the serving pin check.
The test-host aggregate: it is Linux only, and these runs were on macOS.
Linux, Windows and any GPU or device run (Metal, CUDA, HIP): not run. See the receipt.
Receipt
No token, prompt or cache path changes. The one runtime change is the extra field on the failed finished event and the 409 mapped from it.
Main against branch: cells and numbers, or why they can't be run: not run. No GPU or checkpoint run was made for this follow-up. The host tests above are the only evidence.
Boxes it reaches: every backend that serves through the lane host, on the failure path only. No backend or kernel file changes.
New switch? Default, accepted values, profile row: none.
Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: head b93b3e32d on main 1f437b986, Zig 0.17.0, macOS 27 on an Apple M5 Max, host tests only. No backend toolchain, GPU or checkpoint was used.
Paths and platforms the change reaches, which I ran and which I could not: it reaches the handover refusals in lane_stream.zig, the finished event, the server mailbox and the failed branch of the reply's finish in chat_generation.zig. Ran: host tests on macOS arm64. Not run: Linux, Windows, and any Metal, CUDA or HIP device.
Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: n/a, not run. This diff produces and changes no token.
Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): n/a. No checkpoint run was made, and no run on your machines is asked for.
Decode speed before and after, from tools/bench_openai.py: n/a, not measured. No decode code changes.
Speed claims: n/a. This makes no speed claim, so there is no performance receipt.
Prompt speed before and after: n/a. The change cannot reach prompt processing: in lane_stream.zig it only swaps drop for dropHandover on three refusal returns, taken before any lookup or prefill.
Licence of any new weights or drafter, or "n/a": n/a. No weights or drafter.
Checklist
The title and description match the head commit, including the receipt and the stack.
New tests fail before the change, pass after it, and skip cleanly without their dependency. Commit 3's test does: expected 500, found 409 on main, and it passes here. The tests of commits 1 and 2 cover existing behaviour, so they are not expected to fail before; they were run on this head only. None has an outside dependency to skip on.
Comments and docstrings are one line. No measurements or history in the source.
No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off. No token path changes.
Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. Not measured. No token, prompt or cache path changes.
No precision traded for speed. If the bits change, the description says which sums change and why. No arithmetic changes.
A speedup PR includes a tools/perf_receipt.py receipt that passes verify. n/a: not a speedup.
Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled. Not measured. No decode or prompt code changes.
Replaces the message-text prefix match that mapped a failed reply to a 409 handover_not_loaded with a typed FailureCode set by the lane host on handover refusals, plus two test-only commits covering CLI flag-order parsing and scoped-store pressure sharing.
Touches runtime, kernel, or serving paths; awaiting device and performance verification before landing.
Findings:
[NIT]zig/src/core/lane_host.zig: The code is set only when reason == .failed, but dropHandover is also reachable via paths that may finish with a different reason; if any refusal path finishes non-failed the code is silently dropped. Suggested fix: Confirm all three refusal call sites finish with reason .failed; if so this is fine, otherwise set the code independent of reason.
On the nit about failure_code in lane_host.zig: checked, and no change is needed.
dropHandover (lane_host.zig:514) has three call sites, all in lane_stream.zig (23, 25, 29). It sets the flag and returns h.drop, and drop always ends in h.finish(job, .failed, message) (lane_host.zig:522). None of the three can finish with another reason.
The flag has one other setter, refusesHandover (lane_job.zig:80, already on main), for a state that fails to restore. On a normal return its callers drop the job at once (lane_host.zig:438, lane_host_fill.zig:229), so it fails with the code. handover_http_test.zig:365 covers that path end to end: 409 and handover_not_loaded.
A flagged job can finish with another reason in one case: the restore fails and the request is cancelled in the same pass (error.Cancelled from lanes/open_first.zig:51 or 56, then cancel at lane_host.zig:527). It finishes .cancelled with no code, which is what the reason == .failed guard is for: a cancelled request does not report a handover failure. If a halt is draining at that moment, cancel finishes it .failed with the halt's reason and the code, so it answers 409 handover_not_loaded with the halt's text. Its scope is already marked lost by then, so later requests in the scope answer the same code.
READY to land on this head. Re-checked this head after your reply: all three refusal sites finish as failed, the halt case answers 409 with the halt's text, and the new test fails on main (500) and passes here. Nothing more is needed from you; the landing train's checks run before it lands.
Thank you @ThinkOffApp. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Three review fixes held back from #5729, which is now merged. One behaviour changes:
handover_not_loadedfor any failed reply whose message starts withhandover_not_loaded. A completion with no handover got that 409 if its engine's failure text started the same way.failure_code = .handover_not_loadedon the failedfinishedevent, and the server maps the 409 from that code. The message text is unchanged and no longer decides the status.Commits:
0f62b9378, test only:--handoverand--learn-daily-gib 2.5parse the same in either order (handover_cli_test.zig).0acc63819, test only: a populated scoped store shares the prompt-cache budget and sheds under a memory-pressure warning (lane_host_pressure_test.zig).b93b3e32d, the fix:FailureCodeinengine_api.zig.lane_host.zigsets it infinishand gainsdropHandover, which the three refusals inlane_stream.zigcall.mailbox.zigcarries it.chat_generation.zigreads it in place ofstd.mem.startsWith. It adds one test (completion_prompt_test.zig), re-pinslane_host.ziginzig/tests/fixtures/gradient-serving.tsv(the row's note cites Team Drift step 1: hand a kept prompt state to another session of the same model (#2349) #5729, because this pull request had no number yet) and registers the steptest-handover-review-host.Commits 1 and 2 add tests for behaviour main already has and change no source file. They were run on this head only. Commit 3's test is the one that fails before the change.
1f437b986, the three commits above. Main has since moved toe0675feb5(33 commits, 3 Dec 19:28Z). Of the files this change touches it changed only the pin fixture, in other rows, andgit merge-treeof the two is clean. The branch is not rebased yet, so every check below is on1f437b986.atc overlap --json(ATC 0.9.6, 3 Dec 19:08Z): incomplete coverage (pullRequestsLimit,otherPullRequestsLimit,pullFilesUnavailable,timeLimit). It found 25 open pull requests that share a file with this branch and test-merged 10 of them: 3 clean (flashnext: pool lanes keep their states and draft as pieces on whole pages, no run (#2444 P3, F2) #2898, flashnext: the MTP head's streams by row through the lease's pages, no per-lane block outside the pool (#2444 P3, F2 part c) #2992, Flash Next on CUDA: TF_FLASHNEXT_MTP_WEIGHTS selects how the drafter keeps its BF16 linears #3218), 1 unknown (cuda: TF_CUDA_HOST_WFE, opt-in WFET waits for the RoCE proxy and GLM token readbacks #2922), 6 conflicts. The other 15 were not tested.zig/tests/fixtures/gradient-serving.tsv, server: forget one conversation's kept states (POST /v1/imprint/forget) #3226 inzig/src/core/lane_host.zig. Each has the same number of conflict blocks in that file against main1f437b986without these commits (git merge-tree).ghfile lists andgit merge-treeagainst all 398 open pull requests, 3 Dec 19:12Z): 132 share a file with this branch, 81 of them only the pin fixture. 22 merge clean, 21 conflict only in files this change does not touch, and 86 keep the conflict blocks they already have against main. These commits add conflict blocks with three. None is resolved yet. Each is two additions at the same place, for whichever lands second to resolve:lane_host.zig's row in the pin fixture.completion_prompt_test.zig. Both tests stay.zig/build/server.zig. Both stay.Checks on this head
b93b3e32d, on main1f437b986.python3 tools/pr_check.py --base upstream/main: 88 and 88, 0 new. 0 errors, 3 advisory warnings: two inherited import cycles, and the Unreleased line, which it cannot check without a pull request number.zig build -j2 -Dfixed-cpu test-gradient-serving test-qwen-serving-host test-glm-pdl-scan --summary all: 13/13 steps, 9/9 tests pass.zig build -j2 test-lane-api-host test-memory-pressure-host test-lane-strand-host test-lane-explore-host test-lane-halt-host test-lane-interrupted-host test-lane-lone-host --test-timeout 30m --summary all: 24/24 steps, 1134/1134 pass.zig build -j2 test-prompt-cache-host --test-timeout 30m --summary all: 5/5 steps, 866/866 pass.zig build -j2 test-handover-review-host test-serve-flags-host test-memory-pressure-status-host test-qwen27-prefill-stats-host --test-timeout 30m --summary all: 14/14 steps, 146/148 pass, 2 skipped, 0 failed.zig build -j2 test-server-cpu --test-timeout 30m --summary all: 12/12 steps, 2314/2339 pass, 25 skipped, 0 failed.zig fmt --check build.zig zig: exit 0.git diff --check upstream/main..HEAD: exit 0.1f437b986with only commit 3's change tocompletion_prompt_test.zigapplied,zig build -j2 test-server-cpu --test-timeout 30m --summary allfails in that one test, "handover-like engine text never changes an ordinary completion failure status", withexpected 500, found 409(10/12 steps, 2312/2338 pass, 25 skipped, 1 failed). On this head the same step passes. The tests of commits 1 and 2 were run on this head only.zig build testandtest-golden: not run for this follow-up. The steps above are the lane host module's whole suite, the server module's whole suite and the serving pin check.test-hostaggregate: it is Linux only, and these runs were on macOS.Receipt
No token, prompt or cache path changes. The one runtime change is the extra field on the failed
finishedevent and the 409 mapped from it.b93b3e32don main1f437b986, Zig 0.17.0, macOS 27 on an Apple M5 Max, host tests only. No backend toolchain, GPU or checkpoint was used.lane_stream.zig, thefinishedevent, the server mailbox and the failed branch of the reply'sfinishinchat_generation.zig. Ran: host tests on macOS arm64. Not run: Linux, Windows, and any Metal, CUDA or HIP device.tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: n/a, not run. This diff produces and changes no token.tools/bench_openai.py: n/a, not measured. No decode code changes.lane_stream.zigit only swapsdropfordropHandoveron three refusal returns, taken before any lookup or prefill.Checklist
expected 500, found 409on main, and it passes here. The tests of commits 1 and 2 cover existing behaviour, so they are not expected to fail before; they were run on this head only. None has an outside dependency to skip on."draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. Not measured. No token, prompt or cache path changes.tools/perf_receipt.pyreceipt that passesverify. n/a: not a speedup.--drafter, no slower than without it, greedy and sampled. Not measured. No decode or prompt code changes.