fix: preserve latest response after compaction - #643
Open
sunqidong6 wants to merge 3 commits into
Open
Conversation
buildSessionContext sliced the active branch before SDK compaction conversion. When firstKeptEntryId fell outside that page, the SDK dropped retained entries immediately before compaction, including the latest assistant response. Change-Id: I37865692895633f2ce66f1814add34e1e493ddd5
Reuse the compaction-aware turn anchor for grouping, message refs, and minimap nodes so a compacted active turn remains navigable. Change-Id: I810443792fcc0a3224621eeb62463bcfc5cb81a5
Pi Web fed the SDK's compacted model context into UI history, permanently hiding messages before compaction boundaries. Page and render the raw active branch instead while retaining compaction markers. Change-Id: Icc2f2ecc8f19dbf84b4c53f1c6c68f34c38b2857
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
firstKeptEntryIdis outside the paginated windowRoot cause
buildSessionContextsliced the active branch before calling the SDK compaction converter. IffirstKeptEntryIdfell outside that page, the SDK emitted only the compaction and post-compaction entries, hiding the latest assistant response on reload.Verification
npm test(845 passed)node_modules/.bin/tsc --noEmitnpm run linttail=50; both the compaction and latest assistant response are retained