Reuse recorded tokens by default and preserve literal assistant content - #977
Draft
bradhilton wants to merge 15 commits into
Draft
bradhilton wants to merge 15 commits into
bradhilton wants to merge 15 commits into
Conversation
bradhilton
marked this pull request as ready for review
September 25, 2026 20:17
This was referenced Sep 26, 2026
bradhilton
marked this pull request as draft
September 26, 2026 15:46
This branch has not been deployed
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 responses could fail tokenization when a tool call’s structured projection was shorter than the sampled output. Literal
<think>text could also be deleted, and copied responses could receive logprobs from the wrong prompt. This fixes those cases through the existingart.tokenizeAPI, without a new opt-in.Recorded prompt IDs, response IDs, logprobs and source ownership remain authoritative. Complete unchanged Chat histories end at the final recorded output, including length-limited and tool responses. ART proves nonterminal boundaries separately. Historical assistant roles require a full prompt match using the original request messages and tool order; edited histories and explicit template overrides retain rendering.
Plain content stays literal; structured reasoning retains its meaning. Bounded evidence reuse avoids repeated validation within callback-free phases and clears before user callbacks.
Public regressions, real Qwen tokenization and retained failure inputs validate the change. Removing unobserved terminal footers deliberately changes their OUTPUT/SFT inclusion. Captured proofs establish token ownership, not numerical-training or production-speed equivalence.
Validation, compatibility and review scope
afabb3c9f. Canonical CI passed: lint, format, type and lock checks; 1,264 lightweight tests; and 2,294 unit tests (34 skipped, two deselected). The final test-only update separately checks native no-render behavior and explicit rendering; production remains671a9dc1.671a9dc1; a separate copied-context oracle has 30 positive and adversarial controls. Test-only fixture updates keep STOP-authority tests on histories that actually require role rendering.