Skip to content

fix(pflash): tighten drafter tail-capture view-bounds guard (bug #42)#356

Merged
davide221 merged 2 commits into
Luce-Org:mainfrom
dusterbloom:split/02-bug42-tail-guard
Jun 10, 2026
Merged

fix(pflash): tighten drafter tail-capture view-bounds guard (bug #42)#356
davide221 merged 2 commits into
Luce-Org:mainfrom
dusterbloom:split/02-bug42-tail-guard

Conversation

@dusterbloom

Copy link
Copy Markdown
Collaborator

Re-carved from #274 as a standalone fix off current main (extracted from multi-feature commit 51ea345; the ee7 drafter changes are a later PR).

The drafter's tail-capture guard used tail_lo < cs + cl, which admits a view whose n_lookahead rows overrun the chunk when tail_lo lands in a chunk's last n_lookahead rows — a deterministic ggml_view_3d assert at S%4096 in {1..7}. Tightened to tail_lo + n_lookahead <= cs + cl at both capture sites (qwen3_graph.cpp:419, :469).

Added test_drafter_tail_capture_guard.cpp (boundary test). Red→green: reproduces the overrun at S=4097/r=1 with the old guard; all 7 boundary cases + cross-chunk cases pass with the fix. 3 files, +143/-2.

…-Org#42)

Old guard `tail_lo < cs + cl` fires when S%chunk_size ∈ {1..7}, passing
a ggml_view_3d that overruns the chunk by up to 7 rows (deterministic
assert). New guard `tail_lo + n_lookahead <= cs + cl` rejects straddlers.
5 pure-arithmetic unit tests cover the boundary: T1 RED→GREEN, T2-T4 stable.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread server/CMakeLists.txt
easel pushed a commit to easel/lucebox-hub that referenced this pull request Jun 9, 2026
…FAIL)

Bug-repro binary test_drafter_tail_capture_guard_red was compiled but never
registered; CI could not enforce that the old guard reproduces the failure.
easel pushed a commit to easel/lucebox-hub that referenced this pull request Jun 10, 2026
@davide221 davide221 merged commit 1f42436 into Luce-Org:main Jun 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants