PreloadMemoryTool only read the search query from the first content
part, so a leading non-text part (a file/image, or a placeholder text
part some providers require) either skipped the search entirely or
searched memory using the placeholder instead of the user's actual
question. Join text across all parts, matching the same idiom already
used on the memory-rendering side in _memory_entry_utils.extract_text.
Also log retrieval failures through the module's own google_adk logger
instead of the root logger, so operators who configure logging by the
google_adk namespace can observe and alert on a failing memory backend
instead of it looking identical to "no memories matched".
Fixes google#6884
Fixes #6884
Problem
PreloadMemoryTool.process_llm_request in preload_memory_tool.py had two issues, both present on main:
Fix
This keeps the existing fail-open behavior (per #3069) — retrieval failures still don't raise — but they are now observable through the correct logger, and the query no longer silently drops or mis-targets when the first part isn't text.
Test plan
Added two tests to tests/unittests/tools/test_preload_memory_tool.py:
Verified both fail without the fix (reverted preload_memory_tool.py to the pre-fix version and reran):
With the fix restored, the full file passes:
Also ran the broader tools suite filtered on preload (7 passed, no regressions), and formatted with isort/pyink per CONTRIBUTING.md.
AI assistance disclosure
This change was written with the assistance of an AI coding agent (Claude), with the diff reviewed and tests verified by the submitter before opening this PR.