Skip to content

serving: a replacement run stands for zero or more characters, not one or more - #1734

Merged
anderdc merged 1 commit into
testfrom
serving/spells-tolerates-reemitted-char
Aug 29, 2026
Merged

serving: a replacement run stands for zero or more characters, not one or more#1734
anderdc merged 1 commit into
testfrom
serving/spells-tolerates-reemitted-char

Conversation

@anderdc

@anderdc anderdc commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

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

between **<FFFD>⌈m/2<FFFD>⌉** and **m** children

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).

…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
anderdc force-pushed the serving/spells-tolerates-reemitted-char branch from 36d5727 to 97b2f0e Compare August 29, 2026 02:00
@anderdc
anderdc merged commit bb57aa8 into test Aug 29, 2026
3 checks passed
@anderdc
anderdc deleted the serving/spells-tolerates-reemitted-char branch August 29, 2026 02:01
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.

1 participant