Preserve recorded conditioning by default during tokenization - #1014
Merged
Merged
Conversation
bradhilton
force-pushed
the
fix/recorded-native-minimal-on-parser-20260928
branch
2 times, most recently
from
September 28, 2026 13:11
1f1845a to
09789fc
Compare
bradhilton
force-pushed
the
fix/recorded-native-minimal-on-parser-20260928
branch
from
September 28, 2026 14:42
f14968f to
1895678
Compare
bradhilton
changed the base branch from
fix/preserve-literal-reasoning-content
to
main
September 28, 2026 14:42
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.
Complete recorded prompt/output tokens now supply default tokenization for histories, trajectories and groups. A length-stopped turn followed by a recorded prompt no longer gains a reconstructed terminator that changes later sampled conditioning. When only an optional gap or role annotation is unavailable, consistent recorded tokens remain usable with unknown nonsampled roles; inconsistent recorded prefixes still fail.
Original sampled logprobs and source ownership are preserved. Copied responses remain context without borrowed prediction loss. Native and fallback paths certify every required recorded source, including sources omitted by a renderer, and derive terminal ownership from the original history. Complete terminal Messages/Responses records can avoid unsupported Chat projection for both length and normal stops. Explicit rendering remains available; callbacks used for proofs retain source, context, model and STOP checks. A provider stop reason does not invent a token: when the complete record omits EOS, no synthetic STOP token is appended. Earlier opaque nonterminal or multi-message Responses turns can still require unsupported projection; when their native conditioning cannot be proved, tokenization refuses rather than silently discarding sampled targets. This does not claim to solve that inherited limitation.
This is based on main after #1009 and preserves its parser and serialization changes. Two golden updates are intentional: removing one invented duplicate native terminator, and preserving literal Qwen assistant text against an independent raw-template reference.
Validation: 1,659 tests pass on this exact head across trajectories, real preprocessing/packing consumers, and parser coverage. Focused predecessor failures cover terminal boundaries, omitted sampled targets, copied ownership, protocol admission and callback identity. Independent component source reviews, pinned type checks and Ruff pass. Both persistent source-review followups are CLEAR on this exact head and its cumulative interactions. Their owners are closed. All required CI checks passed on this exact head. No frozen experiment or live runtime is changed by this PR. Two previously observed HTTP transport cleanup warnings in unchanged capture tests remain retained and unattributed.
A finite public ABBA screen on predecessor
1895678epreserved full token/logprob/flag/mask and input parity across 12 native/rendered cases. Timings were mixed: the narrow native fixture and rendered paths were roughly 1–5% slower in this local screen, while wider native cases varied. This is a correctness change; no uniform speedup or production-throughput improvement is claimed.