Skip to content

fix(memory): preserve repeated history provenance - #4181

Merged
seratch merged 1 commit into
mainfrom
fix/session-callback-history-provenance
Aug 5, 2026
Merged

fix(memory): preserve repeated history provenance#4181
seratch merged 1 commit into
mainfrom
fix/session-callback-history-provenance

Conversation

@seratch

@seratch seratch commented Aug 5, 2026

Copy link
Copy Markdown
Member

This pull request fixes a session persistence bug where session_input_callback could 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.

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>
@seratch seratch added this to the 0.19.x milestone Aug 5, 2026
@seratch
seratch enabled auto-merge (squash) August 5, 2026 00:24
@seratch
seratch merged commit 154e441 into main Aug 5, 2026
9 checks passed
@seratch
seratch deleted the fix/session-callback-history-provenance branch August 5, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session_input_callback repeating a history item re-persists it as new session input

1 participant