Skip to content

fix: preserve latest response after compaction - #643

Open
sunqidong6 wants to merge 3 commits into
agegr:mainfrom
sunqidong6:fix/compaction-tail-pagination
Open

fix: preserve latest response after compaction#643
sunqidong6 wants to merge 3 commits into
agegr:mainfrom
sunqidong6:fix/compaction-tail-pagination

Conversation

@sunqidong6

Copy link
Copy Markdown

Summary

  • keep pre-compaction tail entries when firstKeptEntryId is outside the paginated window
  • preserve bounded tail pagination
  • add a regression test for compaction followed by session metadata

Root cause

buildSessionContext sliced the active branch before calling the SDK compaction converter. If firstKeptEntryId fell 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 --noEmit
  • npm run lint
  • replayed the reported session with tail=50; both the compaction and latest assistant response are retained

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants