Skip to content

fix: ```json fence tolerance in streamed prefix validation - #27

Merged
NekomyaDev merged 1 commit into
mainfrom
feature/stream-fence-tolerance
Jul 29, 2026
Merged

NekomyaDev merged 1 commit into
mainfrom
feature/stream-fence-tolerance

Conversation

@NekomyaDev

Copy link
Copy Markdown
Owner

Found by the live MiMo smoke run: a reasoning model streams ```json\n{...}``` and the prefix validator aborted at the first backtick — while the non-streaming path (_extract_json) strips fences and accepts the same output. Streaming and non-streaming disagreed.

_FenceFilter buffers chunks until the fence question is decidable, forwards only inner JSON to _PrefixValidator (fence lines can split across chunks — handled char by char), and stops forwarding at a closing fence at line start. Genuine markdown (**Summary:** ...) still early-aborts on the first * — token savings preserved.

Sandbox tests

  • Fenced stream validates ✓ (the exact MiMo failure mode)
  • Fence split char-by-char across 29 chunks ✓
  • Bold markdown → early abort → repair round returns fenced JSON → success ✓
  • Plain JSON path unchanged ✓

@NekomyaDev
NekomyaDev merged commit c303df2 into main Jul 29, 2026
2 checks passed
@NekomyaDev
NekomyaDev deleted the feature/stream-fence-tolerance branch July 29, 2026 16:26
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