Repository navigation
fix(memory): skip thought parts in in-memory search and preloaded memories - #1975
Merged
baptmont merged 2 commits intoOct 27, 2026
Merged
Conversation
…ories Thought parts are the model's reasoning, not conversation. The in-memory service indexed them for search and returned them in entry content, and preloadmemorytool wrote them into the PAST_CONVERSATIONS instruction. Skip them in both places, matching adk-python b138b5a6a. Closes: google#1974
Contributor
|
Hi @Vivek1106-04 I verified the fix locally, and it correctly skips thought parts in both memory search results and the preload memory tool. Everything works as expected. Thanks for addressing this!
|
baptmont
approved these changes
Oct 27, 2026
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.



Linked issue
2. Describe the change:
Problem:
The in-memory memory service indexed thought parts for search and returned them in entry content, and
preloadmemorytoolwrote them into the<PAST_CONVERSATIONS>instruction. So the model's old reasoning was matched on and fed back as conversation.Solution:
Skip
Thoughtparts inAddSessionToMemory(for words and for the stored content, which is now a copy with only the visible parts) and inpreloadmemorytool'sextractText. Same as adk-python b138b5a6a.Behavior change
Search no longer matches words that only appear in thought parts, returned entries don't include thought parts, and the preloaded instruction leaves them out. An event with only thought text is no longer stored in memory.
Testing Plan
Unit Tests:
Added
Test_inMemoryService_SearchMemory_SkipsThoughtPartsand two cases toTestPreloadMemoryTool_ProcessRequest(mixed entry, thought-only entry).With your source change reverted and your tests kept, which test fails?
With the change,
go test -race ./memory/... ./tool/...passes and golangci-lint is clean.Manual End-to-End (E2E) Tests:
N/A, covered by the unit tests.
Checklist