model: fail closed on unaligned prefix resume (#47) #76

Merged
Grok merged 2 commits from agy/issue-47 into master 2026-09-25 22:37:11 +02:00
Owner

Fail closed on an unaligned prefix resume (plan["lead"] is not None) in all four chunked
prefill paths of Qwen36Model (traced single-device, eager TP, traced TP). The
unaligned-resume run-up is unqualified: no record covers it, and it is unreachable under
valid configuration. Today it would run silently and produce unverified state; after this it
raises with the path name, the lead extent and a pointer to issue #47.

Adds bench/fixtures/fixtures-prefix-unaligned-resume-test.py covering the plan shapes.

No production behaviour change on any qualified configuration — the asserts only fire on
a path that was already outside the qualified scope.

Master merged in first (branch was cut before PR #68). Verified after the merge: docs/
still 11 files, no root CLAUDE.md, AGENTS.md is the lean rewrite,
QWEN36_PREFILLED_SLOTS_FIX still in qwen36_vllm.py, and the only file added versus
master is the fixture test. No PR #68 deletion was resurrected.
scripts/check-cited-records.py passes locally.

Closes #47.

🤖 Generated with Claude Code

Fail closed on an unaligned prefix resume (`plan["lead"] is not None`) in all four chunked prefill paths of `Qwen36Model` (traced single-device, eager TP, traced TP). The unaligned-resume run-up is unqualified: no record covers it, and it is unreachable under valid configuration. Today it would run silently and produce unverified state; after this it raises with the path name, the lead extent and a pointer to issue #47. Adds `bench/fixtures/fixtures-prefix-unaligned-resume-test.py` covering the plan shapes. **No production behaviour change** on any qualified configuration — the asserts only fire on a path that was already outside the qualified scope. Master merged in first (branch was cut before PR #68). Verified after the merge: `docs/` still 11 files, no root `CLAUDE.md`, `AGENTS.md` is the lean rewrite, `QWEN36_PREFILLED_SLOTS_FIX` still in `qwen36_vllm.py`, and the only file added versus master is the fixture test. No PR #68 deletion was resurrected. `scripts/check-cited-records.py` passes locally. Closes #47. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Verification of Issue #47 establishes that the unaligned-resume path
in chunked prefill is unreachable under any valid configuration:
1. qwen36_prefix_cache requires block_size >= 2048 and block_size % 2048 == 0
2. prefill_chunk_plan requires chunk_size % block_size == 0
3. model.py and warmup enforce chunk_size == 2048
Together these admit exactly block_size = 2048, and prefix hit starts are
multiples of block_size, so start % chunk_size == 0 always and lead is None.

Add fail-closed assertions asserting plan['lead'] is None across
prefill_traced_chunked, _prefill_chunked_eager_tp, and _prefill_traced_chunked_tp
with an explicit error message citing Issue #47, while preserving defensive
lead-execution logic if chunk_size is ever raised. Add host-only test
bench/fixtures/fixtures-prefix-unaligned-resume-test.py verifying
unreachability, uniqueness, re-open triggers, and fail-closed crash behavior.

Co-Authored-By: Gemini 3.8 Flash via agy <noreply@google.com>
merge master into agy/issue-47
All checks were successful
tt-stack-ci / Report upstream drift (pull_request) Successful in 7s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 14s
f24e4740db
Grok merged commit 8f57029aea into master 2026-09-25 22:37:11 +02:00
Author
Owner

agent-gateway closeout (merged): cleared agent:* labels.
Hermes kanban card (if any) is left for Hermes to archive/complete.

agent-gateway closeout (merged): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitpartner/tt-stack!76
No description provided.