docs: fix delete_old_messages example to properly demonstrate deletion effect#4009
Merged
Naomi Pentrel (npentrel) merged 2 commits intoMay 29, 2026
Conversation
Contributor
|
Thanks for opening a docs PR, Udit Sharma (@uditstocks)! When it's ready for review, please add the relevant reviewers:
|
b739c77 to
18bf2d3
Compare
|
Thanks for implementing this based on my issue #3894. I verified the original behavior locally as well, and the reproduction flow correctly demonstrates the deletion effect. I’m new to contributing to this repository, so I really appreciate your help turning my initial issue and reproduction idea into a proper PR. |
Lauren Hirata Singh (lnhsingh)
requested changes
May 27, 2026
Collaborator
Lauren Hirata Singh (lnhsingh)
left a comment
There was a problem hiding this comment.
Thank you for the PR! Please mirror the change in JS as well
- Added unrelated conversation turn (cat poem) in JS section - Updated JS output block to show correct deletion behavior - Agent now correctly responds it does not know the name
18bf2d3 to
56a106c
Compare
Contributor
Author
|
Hi Lauren Hirata Singh (@lnhsingh) I've mirrored the change in the JS section as well. |
Naomi Pentrel (npentrel)
approved these changes
May 29, 2026
Contributor
Naomi Pentrel (npentrel)
left a comment
There was a problem hiding this comment.
Thanks!
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.
Overview
The existing
delete_old_messagesexample in the short-term memory documentation failed to properly demonstratethe deletion effect. After deleting the earliest two messages, the agent could still recall the user's name "Bob" because
the AI's own first response had echoed the name - and that response survived the deletion window.
This PR fixes the example by inserting an unrelated conversation turn (a cat poem)
between the name introduction and the name recall query. This naturally pushes the
name-containing messages out of the window, so when the agent is asked "what's my name?"
it correctly responds that it doesn't know.
Type of change
[Update existing documentation]
Checklist
docs devRelated issues/PRs
closes #3894
Additional notes
The fix is minimal and surgical - only the example code and output block are changed.
No API behavior, no logic, no navigation changes. The updated output block is taken
from an actual local run to ensure accuracy.