Repository navigation
serve: hold a request's next call through one owner - #689
Conversation
The prompt-boundary and schema-fill gates had no doc comment of their own.
turn, pump_ready and a fill's flush each pumped a request and kept its call by hand. hold_need keeps the call take_need gives, and take_need, holding pump_at's body, is the one place a request is pumped, so a held call is never pumped over.
There was a problem hiding this comment.
Verdict: CLEAN: The refactor preserves token delivery, request termination, and engine-call scheduling.
Checked
Duplicates: 1 new item checked (hold_need); no existing duplicate. Dryer reported 0 candidate pairs.
Complexity: take_need 1 → 7 incorporates the unchanged pump body; step 25 → 26 replaces the existing fill-result branch. Neither adds a scheduling decision.
Silent failure: 2 terminal paths followed. Completed and failed pumps still remove and book the request; errors reach the client through Msg::Done.
Tests: assertions unchanged. The property-name delivery assertion guards the post-fill hold at crates/serve/src/worker.rs:792; the delivered-token assertion guards the ready hold at crates/serve/src/worker.rs:1173. The PR reports these and four other mutations failed on an earlier head that differed only in a doc comment.
Gates: no pins, thresholds, test cases, or assertions moved.
Performance: the serve scheduler adds one Option take/store per visit to a request holding a call. Pump, allocation, launch, copy, and sync counts remain unchanged.
Escape catalog: no patterns matched.
Notes
Verification here was static. Gates and mutations were not rerun; the PR reports a passing gate-serve run.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
serve worker에서 요청이 다음 engine call을 들고 있게 하는 단계를 helper 하나로 모으고, 이전 PR이 넣은 두 hw 시험에 각자 확인하는 내용의 doc 주석을 답니다. 동작은 바뀌지 않습니다.
Part of #565.
What and why
This is a cleanup that follows #671 (merged). Behavior does not change, and no checklist line of #565 closes.
#671 made a request's tokens reach its client before the engine runs another request's call. Two things it left behind are fixed here.
crates/serve/tests/slots/yields.rs:292now says whathw_a_decode_answer_reaches_the_client_before_a_new_prompt_startschecks, and:682does the same forhw_a_schema_fill_reaches_the_client_before_the_next_fill_finishes.crates/serve/src/worker.rs: inturn, inpump_ready, and after a fill instep. It is nowhold_need(worker.rs:1182), called fromstep(:792),turn(:1065) andpump_ready(:1173).take_need(:1193) now holds the pump itself, so the pump has one site, where it had four before. Becausetake_needreturns the call a request already holds before it pumps, a pump cannot run on top of a held call. The count of copies of.need = Some(need)goes from three to one.Active::need(worker.rs:310) said the field is only used under turns, which stopped being true with #671. The doc comment now says what the field holds today.Pumps, engine launches, copies and syncs stay the same in number. The only new work is moving one
Option<Need>out of a request and back in for requests that already hold a call.Release notes: Under the hood: the serve worker keeps a request's next engine call through one helper, and the two yield gate tests say what they check.
Code shape
hold_needis the one place that keeps a pumped call on its request, andtake_needis the one place that pumps. The three hand written copies inturn,pump_readyand the fill path are gone.pump_atand the one linetake_needit fed became one function.hold_needreturnsfalsefor it.Active::needcomment and the new doc comments describe the current code.cargo fmtis clean on the two changed files.cargo clippyhas not been run on this head.Duplication found or removed (
path:line): the three copies named above, nowcrates/serve/src/worker.rs:1182.What I ran
The head is
ea1a4094788f068b263be3eb84c768c8a5efadc8, two commits on main31b5be41f3d58ff47fd43f0c8bfd4695f087395a.The command also runs the
bloomery-servelibrary tests and the other serve test targets. The library tests had 344 passing.Each call of
hold_needwas removed in turn, and so were thepump_readycalls in the run loop (after a step, after a start and after a prompt finishes). Every one of these six mutations is caught by the test that guards that call. This ran on an earlier head of this branch that differs from the final one only in a doc comment onhold_need:The tree was restored after each mutation. The tests use a mock engine, so no model file is needed.
I did not run an A/B. The change adds no launch, copy or sync, and the pump count is unchanged.
GPU Evidence
crates/servehas no CUDA code. The gate ran on a GB10 machine; these lines come fromnvidia-smithere:What I ran into
This does not block the PR.
cargo clippyandjust contrib-checkhave not been run on this head.Hardware
A GB10 (aarch64 Linux, 20 CPUs), driver 595.84, CUDA 13.3, for the gate and the six mutations.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.