serving: a replacement run stands for zero or more characters, not one or more - #1734
Merged
Merged
Conversation
…e or more An honest miner on the blessed pin was missed twice in soak 7 with "token ids do not spell the completion", at 384 tokens and again at 128. Captured from the pod: the runtime splits a multibyte character across two streamed chunks, decodes the first chunk alone and streams U+FFFD for it, then streams the whole character once the rest of its bytes arrive. The caller receives "**<FFFD>[m/2<FFFD>]**" where the reference reads "**[m/2]**" - the run sits BESIDE the character it stands for, so the reference has nothing there for it to consume, and requiring one character per run fails. Zero or more matches what the runtime does. ASCII still cannot be added, dropped or changed behind a run, which is what the check is for.
anderdc
force-pushed
the
serving/spells-tolerates-reemitted-char
branch
from
August 29, 2026 02:00
36d5727 to
97b2f0e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An honest miner running the blessed pin was missed twice during soak 7 —
token ids do not spell the completion, once at 384 tokens and again at 128. Both cost a window slot for a completion that was correct.Captured directly from the pod: sparkinfer splits a multibyte character across two streamed chunks, decodes the first chunk on its own (so it streams U+FFFD), and then streams the whole character once the remaining bytes arrive. The caller receives
where the reference reads
between **⌈m/2⌉** and **m** children.spells()modelled a replacement run as standing in place of one or more non-ASCII characters ({1,n}). Here the run sits beside the character it stands for — the character is present too — so the reference has nothing at that position for the run to consume and the match fails. Verified against the captured strings:{1,n}→ False,{0,n}→ True.Zero-or-more is what the runtime actually does. The guarantee the check exists for is unchanged: ASCII still cannot be added, dropped or changed behind a run, and the existing
not spells(b'hello', 'h<FFFD>llo')case still refuses. Tests cover the re-emitted-character shape from the soak plus the alter/drop/add cases.Related: #1732 removes the damage at source for the assembled completion (rebuilding it from per-token bytes), which fixes the same miss where every token reported bytes. This one covers the transcript check itself, which has to hold whenever bytes are missing or partial. They are independent and each stands alone.
CI green (ruff, format, pyright, vulture, 760 tests).