Repository navigation
serve: n on /v1/chat/completions and /v1/completions answers that many choices of the prompt, queued together, choice i seeded with the request's seed plus i - #959
Conversation
|
The #962 and #963 show the same thing, with (AI 코딩 에이전트가 작성한 코멘트이며, 내용은 제가 확인했습니다.) |
d779b63 to
b98f3a6
Compare
There was a problem hiding this comment.
Verdict: MUST_FIX: Supporting multiple choices breaks an existing serving gate, and Events adds an unused Clone implementation.
Must fix
1. Update the existing gate for supported choice counts
crates/serve/src/api.rs:4342 accepts chat requests with n=2. The ignored hw_unsupported_fields_are_refused test sends that count at crates/serve/tests/serve.rs:440, then asserts 400 at line 449. Its default mock server now returns 200. just gate-serve includes ignored tests, so this assertion fails.
Cost: Update the gate with the feature so the required serving checks can pass.
Replace the gate's ("n", json!(2)) row with:
// PIN(2026-10-29): chat supports n=2; exercise a count beyond its capacity.
("n", json!(serve::MAX_CONNECTIONS + 1)),2. Remove the unused Events Clone implementation
crates/serve/src/worker.rs:151 derives Clone, but every Events value is moved or borrowed. The multi-choice construction at api.rs:3369 clones the underlying sender before wrapping it. No caller needs the derived implementation.
Cost: Removing the derive keeps the new internal interface limited to its actual uses.
Replace the derived definition with:
pub(crate) struct Events {
tx: mpsc::Sender<(usize, Msg)>,
choice: usize,
}Non-blocking
⚠ Test admission of the whole request: crates/serve/src/api.rs:3378.
Deleting admits(subs.len()) is not caught by the new HTTP tests: they submit multiple choices into an empty queue. The existing queue gate uses one-choice /completion requests. Extend it with an OpenAI request whose choices only partly fit; assert 503 and no added engine calls.
Checked
Elements: All Events references checked; its Clone implementation has no caller.
Admission: The batch check and enqueues hold the same board lock. Scheduler tests exercise Board::admits directly; they do not protect its HTTP call site.
Tests: Static inspection confirms the stale 400 assertion and the missing partial-capacity case. No tests were executed.
Gates: No existing pin or tolerance moved. The ignored rejection gate is inconsistent with the feature.
Escape catalog: C1–C4 do not match these findings. No ledger lessons apply.
Notes
The PR includes client-run output on GB10, but no just gate-* run or nvidia-smi output.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
| #[derive(Clone)] | ||
| pub(crate) struct Events { |
There was a problem hiding this comment.
Events is only moved or borrowed; the multi-choice path clones the sender before wrapping it. Remove the unused Clone implementation.
| #[derive(Clone)] | |
| pub(crate) struct Events { | |
| pub(crate) struct Events { |
…y choices of the prompt, queued together, choice i seeded with the request's seed plus i
b98f3a6 to
874b40f
Compare
There was a problem hiding this comment.
Since the last review:
- Fixed: the rejection gate now uses an unsupported count and a dated reason at crates/serve/tests/serve.rs:440.
- Fixed: the unused
EventsClone implementation is removed at crates/serve/src/worker.rs:151. - Fixed: the admission advisory has a partial-capacity case, 503 assertion, and engine-call count at crates/serve/tests/slots/mod.rs:330.
Verdict: CLEAN: The prior findings are addressed, and no new must-fix defect survives the interdiff review.
Checked
Duplicates: 0 new named definitions; the new at_once closure was checked against HTTP helpers. Dryer reports 0 pairs.
Complexity: crapper reports run_choices 28 (new orchestration), chat 39→44 and completions 18→22 (choice loops), and step 28→30 (dispatch branches). These functions are not edited by the interdiff.
Silent failure: 2 changed sites followed. Channel timeout/disconnection becomes None and fails a named expect; a failed send cannot turn that failure into a passing test.
Tests: Static mutation check: dropping the capacity guard at sched.rs:244 makes the partial request wait and fail its expect. Removing the upper-bound filter at api.rs:4336 changes the rejection from 400 to 503 and fails the status assertion. Tests were not executed here; the PR reports gate-serve PASS.
Gates: The changed rejection case has PIN(2026-10-29) and its reason. No tolerance moved.
Concurrency: Batch admission and enqueue hold one board lock; disconnect cleanup removes all queued choices. Prompt reuse still calls the test engine's prefill, including an empty tail.
Escape catalog: No C1–C4 pattern matches. No ledger lessons apply.
Notes
The PR lacks the nvidia-smi output required for GPU evidence.
🔨 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. |
/v1/chat/completions와/v1/completions가n을 받아 한 prompt에 대한 choice를 n개 돌려줍니다.Part of #565.
What and why
bloomery-serveanswerednwith a 400 ("n is not supported by this server"). Clients that ask for several candidates of one prompt had to send n requests. Nownon/v1/chat/completionsand/v1/completionsreturnsnchoices withindex0 to n-1, for whole and streamed replies.--parallel N. If the board cannot take all of them, the request gets a 503 and none of them start.iis seeded with the request'sseedplusi, so a request with a seed is reproducible, and choiceiequals then=1reply with seedseed + i. Withn=1nothing changes.usagecounts the prompt once and sums the completion tokens of all choices.timingscome from the first choice.nmust be between 1 and slots plus queue depth (64 by default); anything else is a 400 that names the range./completion,/v1/responsesand/v1/messagesstill refusen > 1by name.indexas they are produced, and the finish chunks follow in choice order once every choice has ended.Release notes: Added:
non/v1/chat/completionsand/v1/completionsreturns that many choices of the prompt (choiceiis seeded withseed + i).Code shape
run_genandrun_wholeare one-choice wrappers over the newrun_choicesandrun_whole_choices, so the single-choice and multi-choice paths share one owner. The chat parser and its state types gainedCloneso each choice starts from the same parser.crates/serveanddocs/serving.md; no model file changed.run_genno longer returns a slot that no caller used.noutside the range, andn > 1on the routes that do not support it, are named 400 errors.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none.What I ran
Card: NVIDIA GB10, driver 595.84. Model: Qwen3.8 FP4-Local. The binary is the real
bloomery-serve, built withand started as
bloomery-serve -m <Qwen3.8-Flash-Next-FP4-Local folder> --host 127.0.0.1 --port 18733 --parallel {1,2} --ctx-size 16896. A client then posts to both routes withtemperature 0.8,max_tokens 40andstream_options.include_usage: chat with the promptWrite one short sentence about the sea.andreasoning_effort: none, completions withThe sea at night is. Each route getsn=1with seeds 42, 43 and 44,n=1greedy, andn=3seed 42 whole and streamed. The same requests ran against a binary of the base commit.The run was on commit
50daca1a32b90e6c1726ba1b2d150754df598f88, base5e743ada812e7377054e4d8a8756b7c466c833ae. The base binary refusesn=3:The branch answers it with three choices, and the choice for seed 42 is the base's
n=1reply:Summary lines of the client's checks (34
CHECK PASS, none failed). The checks are the same for chat and completions, and they ran with one slot (--parallel 1, MTP draft) and two slots (--parallel 2, draft off):The same
n=3request on the PR headd779b63a7a6c404298d16ff2d12bbdb428e764f0(basee85f0c8cbdb884bec5144705902422166123ac55), with one slot and with two slots, on the same card:The serve gate, which runs the
bloomery-servecrate tests including thenrange and queue-depth cases (nabove the connection limit is a 400, and ann=2request that finds room for one choice gets a 503 and starts none):AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.