feat(gateway): replace content markers with fingerprint-based session tracking#125
Merged
feat(gateway): replace content markers with fingerprint-based session tracking#125
Conversation
… tracking Session identification previously injected a visible [lore:sessionID] marker into the first response content, causing: - Markers appearing verbatim in chat UI - Title/summary generation requests getting branded via message history - First request forced to non-streaming to enable marker injection Replace with SHA-256 fingerprint of the first user message combined with message-count proximity matching (threshold=20) to disambiguate forked sessions that share the same first message. Forked sessions drop message count significantly (e.g. parent at 600, fork at 300) while normal turns grow by 2-6 messages per turn. Removes the entire forced non-streaming path, the marker injection block in compaction, and the marker scanning from the observer hook. All responses now stream natively from the first request.
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.
Summary
[lore:sessionID]content markers from responses — they were appearing verbatim in chat UI and contaminating title/summary generation requests via message historyHow fork disambiguation works
Normal turns grow message count by 2–6 per turn. A forked session drops count to the fork point (e.g. parent at 600, fork starts at 300). Any session with the same fingerprint but a message count drop exceeding the threshold (20) is treated as a new fork session.
Tests
All 94 gateway tests pass. Updated 3 tests that were asserting marker presence to instead assert marker absence.