Repository navigation
fix(compaction): Keep earlier Turns' answers out of the Turn after a history replacement - #3695
Closed
sentry-junior[bot] wants to merge 2 commits into
Closed
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
…ter a summary swap A prepared-summary swap keeps every message after its mark, so the replacement can hold reply or noReply results of earlier Turns. The swap now returns where the current Turn starts inside the replacement, and the Turn cursor maps the saved Turn-start seq back by position, because swapped history has out-of-order seqs. Fixes #3687 Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… a resumed slice A resumed slice read the Turn answer from the saved Turn start. After a replacement in that slice, the saved index points into the old history. Co-Authored-By: David Cramer <[email protected]>
Contributor
|
11 screenshot changes — 11 changed · 0 added · 0 removed Review screenshots in Frameshift |
Contributor
Author
|
Replaced by #3705, which decides Turn membership by event seq instead of fixing the Turn start index. Closing this one. |
This branch was successfully 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.
Fixes #3687.
Before: A prepared-summary swap keeps every message after its mark, so the replacement can hold
replyornoReplyresults from earlier Turns. After any replacement, the Turn start was set to 0. A gated Turn then counted an earlier answer as its own: a resumed slice returned without calling the model, and the Turn ended with the earlier answer.After: After a replacement, only the current Turn's messages count toward its answer, also after a pause and resume.
compactWithPreparedSummaryreturnsturnStartMessageIndex, the index of the current Turn's first message in the replacement. When the Turn starts after the mark, that is the same kept message as before the swap. Otherwise it is 0, because before the kept messages the replacement has only user messages, the summary, and system state. A blocking summary still uses 0.<=that seq. After a swap the seqs are out of order: kept messages keep their source seq, and the summary, runtime context, and folded system message get the seq of the swap. So the count put the start too early, on the earlier answer. Now the cursor finds the position of that seq, and counts only when the seq is not in the history.turnStartIndex()read the saved record's Turn start before the live one. After a replacement in that slice, the saved index points into the old history. It now uses the Turn start that the replacement set.Open question: this keeps the Turn boundary as an index into history that each replacement must remap (see #2567). An explicit Turn boundary could replace these fixes.
via @dcramer.
--
View Session [Sentry]