fix(memory): preserve repeated history provenance - #4181
Merged
Conversation
Retain callback history object identities before invocation so repeated or moved history items cannot be persisted as fresh input, while preserving post-callback replacement and bounded content matching behavior. Co-authored-by: Henry Su <henrysu4707@gmail.com>
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 pull request fixes a session persistence bug where
session_input_callbackcould return or move the same history object multiple times and have later occurrences stored as fresh input, causing stored history to grow across turns.It retains the original history-object provenance before invoking or awaiting the callback, while preserving post-callback history replacement and bounded content-matching behavior. Genuine new items that equal history content continue to persist normally.
This carries forward the core fix from #4072 and credits Henry Su as a co-author. It also covers callback list mutation and cross-list movement that the original PR did not handle safely. This pull request supersedes #4072, which can be closed once this lands.
This pull request resolves #4069.