Add raw frontier path for debug MTP chat reuse#3
Open
guelfoweb wants to merge 3 commits into
Open
Conversation
Export raw emitted token ids and end-turn frontier ids from persistent MTP completions. Store committed raw frontier separately from the visible chat frontier. Add debug-only chat follow-up reuse using raw frontier + visible prefix matching. Keep safety fallback as default. Do not promote multi-turn persistent MTP reuse yet.
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.
This PR adds a token-level raw frontier path for persistent MTP chat reuse, kept behind debug flags.
Problem:
Persistent MTP reuse across chat turns could corrupt output because the client and shim were using different frontier representations:
This could lead to corrupted follow-up output such as
s,t,e,p...orempty-visible-content.What changes:
Flags:
Default: safety fallback remains active.
Debug reuse:
ORBIT_MTP_CHAT_REUSE_RAW=1ORBIT_MTP_CHAT_REUSE_DEBUG=1Validation:
PYTHONPATH=src python3 -m unittest tests.test_native_streaming tests.test_native_thinking tests.test_native_mtp_experimental tests.test_native_session_state tests.test_native_persistent_mtp -qPASSpython3 -m compileall -q src tests scriptsPASSgit diff --checkPASSSmoke:
Default safety:
Debug raw reuse:
4-turn chat passed
follow-ups stayed on MTP
reused tokens observed:
no
s,t,e,p...no
empty-visible-contentno control-token loop
Risk:
This does not promote multi-turn MTP reuse to default. It only makes the raw token-level path available behind debug flags. Default promotion should require broader multi-turn benchmark and stability validation.
Final decision:
Merge candidate as debug-only infrastructure.