Repository navigation
gpu-gates: read the Qwen3.8 greedy draft and cache counts strictly (#1129) - #1130
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: sibling streaming and media readers still allow malformed draft counters to pass their gates.
Must fix
1. Apply the strict draft reader on the sibling paths (kind B)
crates/gpu-gates/src/bin/gate_qwen38_serve.rs:1996 accepts draft_n=10, draft_n_accepted=11. The slots_alone_draft_counts_stay check at line 2321 passes when alone and concurrent responses carry that same invalid pair: it checks positive proposals and tuple equality only.
crates/gpu-gates/src/bin/gate_glm5next_serve.rs:2886 and crates/gpu-gates/src/bin/gate_glm5next_serve.rs:2915 accept {"draft_n":10} without an accepted count. Both media checks still pass when their other conditions hold; the accepted count is only printed, with a zero default. These are remaining copies of the malformed-counter defect this PR fixes.
Reusing the existing parser now costs three local edits and closes these gate escapes. In Qwen's streamed_with, replace the if let block with:
if v.get("timings").is_some() {
drafts = draft_counts(&v).map_err(|e| format!("curl {url}: {e}"))?;
}Replace GLM's image count binding with:
let image_drafted = draft_counts(&reply)?.0;Replace GLM's text count binding with:
let drafted = draft_counts(&reply)?.0;Non-blocking
⚠ Reader regression coverage is missing: crates/gpu-gates/src/bin/gate_qwen38_serve.rs:1239.
The existing draft_counts tests call the shared parser, not the changed readers. Restoring the old reader defaults leaves those tests green.
Exercise malformed responses through the changed readers and attach FAIL-first output. This protects the call sites from bypassing the parser again.
Checked
Duplicates: 0 new definitions; the proposed replacements reuse the existing draft-count owner.
Complexity: Qwen greedy adds fallible reads without a new dispatch branch or separate responsibility.
Silent failure: 3 changed reads propagate named errors to failed gate exits; 3 sibling reads retain the escapes above.
Tests: no tests changed; static mutation review found the reader-default mutants unguarded. No runtime tests run in this review.
Gates: no pins, tolerances or clauses removed or relaxed.
Escape catalog: no C1–C4 patterns matched. The change touches gate tooling, with no inference hot path.
Notes
The PR body supplies builds and a type check, but no just gate-* run with output or model path.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_glm5next_serve.rs, crates/gpu-gates/src/bin/gate_qwen38_serve.rs and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
…idagedev#1129) The greedy /completion reader defaulted a malformed timings.draft_n to 0 and a missing timings.cache_n to u64::MAX, so a slot-file comparison of two equally malformed answers passed. Read draft_n through serve_client::draft_counts and refuse a missing cache_n by name.
93ddf1d to
0dd5cbf
Compare
There was a problem hiding this comment.
Since the last review:
- Must-fix 1 is fixed: Qwen streaming and both GLM media readers now call
draft_counts. - The reader regression-coverage warning remains open at crates/gpu-gates/src/bin/gate_qwen38_serve.rs:1239.
Verdict: CLEAN: The revision closes the reported malformed-counter escapes and introduces no blocking defect.
Non-blocking
⚠ Reader regression coverage remains missing: crates/gpu-gates/src/bin/gate_qwen38_serve.rs:1997.
The existing tests exercise draft_counts and LookupCompletion::read, not these reader call sites. Restoring the old reader defaults leaves those tests green.
Exercise malformed responses through the readers and attach FAIL-first output. This catches a future bypass of the parser.
Checked
Duplicates: 0 new definitions; the three revised reads reuse the existing parser. No dryer pairs were supplied.
Complexity: crapper flags GLM media 32 → 34 and Qwen greedy 16 → 18; fallible reads grow within existing responsibilities.
Silent failure: 6 changed reads followed. Invalid counters propagate named errors or failed requests; the remaining media display defaults follow strict validation.
Tests: none added or changed. Static mutation check: restoring reader defaults leaves the shared-parser tests green. No runtime tests run.
Gates: no pins moved or clauses removed. Missing count partners and accepted counts above proposals are rejected; omitting both counts remains valid for requests that proposed nothing.
Escape catalog: no C1–C4 pattern matched. Only gate tooling changes; no inference hot path changes.
Notes
Diagnostics reports that dryer did not run.
The PR body supplies builds and a type check, but no just gate-* run with output or model path.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_glm5next_serve.rs, crates/gpu-gates/src/bin/gate_qwen38_serve.rs and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 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. |
Qwen3.8 serve gate의 greedy reader가 빠지거나 깨진 draft와 cache 카운터를 0이나 최댓값으로 채우지 않고 이름 있는 오류로 멈추게 고쳤습니다.
What and why
Fixes #1129. The greedy reader in
gate_qwen38_servetook a missing or malformedtimings.draft_nas 0 and a missingtimings.cache_nasu64::MAX. Inslot_file_restore_is_the_straight_run,back.draft_n == straight.draft_ntherefore passed when both answers carried malformed counters (0 == 0), and a missingcache_npassedback.cache_n == straight.cache_n && back.cache_n > 0andreused.cache_n >= start. The reader now takesdraft_nfromserve_client::draft_counts, the parser the GLM gate and the lookup reader already use, so a half-present, non-integer, zero oraccepted > proposedpair stops the gate with a named error. A missingcache_nis refused with the same messageserve_clientuses for/completion.Turn::runingate_glm5next_servehad the samecache_ndefault and gets the same error. Only gate readers change; no server, engine or model code is touched.Release notes: internal: the Qwen3.8 and GLM serve gates no longer pass a response with missing or malformed draft or cache counters.
Code shape
The review reads these first. A box left unticked needs one line of why.
copying it (
AGENTS.md"Common code first",docs/rust-quality.mdR14). Where I found an existing copy, Inamed it below.
(tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
tools/check-comments.sh).PIN(YYYY-MM-DD):and its reason.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none. The draft count parsing already lives inserve_client::draft_counts; the gate now calls it instead of reading the field itself.What I ran
Upstream base
22ab72204adc69656f0808b5b1f24ec81d68e7a6, PR head8ca9ecd47ae9242a609687dc0315507fe6ff5af8.Card and driver:
Release build of the changed Qwen3.8 gate binary on the card host:
Type check of both changed gate binaries (exit status 0, no diagnostics):
Hardware (if the change is for a machine)
NVIDIA GB10, driver 595.84, CUDA 13.3 (
nvidia-smiabove).AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.