Skip to content

PreloadMemoryTool builds its memory query from the first content part only, and reports retrieval failure only to the root logger #6884

Closed

Description

@hawktang

Two small issues in preload_memory_tool.py, both present in 2.7.1 and on current main.

1. The query is taken from the first content part only. The tool reads the user's query from the first part of user_content and returns early when that part has no text. This produces two silent failures. If the first part is a file or image — the natural shape of "here is a document, answer using it and what you know about me" — the tool returns before searching, so memory contributes nothing. If an application prepends a short placeholder text part (a common workaround for providers that reject a leading non-text part), the early return does not fire and memory is instead searched for the placeholder rather than the user's actual question. Both cases degrade answer quality with no error surface.

Worth noting that the same module's memory-side helper already joins the text across all parts when rendering retrieved memories, so the "join every text part" idiom exists in the file; only the query side does not use it.

2. Retrieval failure is reported to the root logger. The module defines its own google_adk.* logger but the retrieval except path logs through the root logging module instead. Applications that configure logging by the google_adk namespace therefore never see it. Combined with the silent return, a memory backend that is down, misconfigured, or unauthorized is indistinguishable from "no memories matched" — the agent simply answers worse.

Fail-open on retrieval is the right behavior and I am not asking to reverse #3069; the request is only that the failure be observable — the module's own logger at minimum, so operators can alert on it.

Versions: observed on 2.7.1 and on main.

Not a Contribution: this report is provided for informational purposes only and is not intended as a Contribution under the Google CLA.

Activity

  1. chelsealong commented on Aug 24, 2026

    @chelsealong
    Contributor

    Picking this one up now — opening a PR shortly. Flagging it here so nobody duplicates the work; if someone is already on it, say so and I will drop mine.

  2. added
    tools
    on Aug 25, 2026
  3. sanketpatil06 commented on Aug 26, 2026

    @sanketpatil06

    Hi @hawktang, thanks for reporting this issue.
    We see that PR #6885 is already open to address this. Could you please confirm if that resolves the issue on your end before we move forward with reviewing and merging it?

  4. added
    request clarification
    on Aug 26, 2026
  5. hawktang commented on Aug 27, 2026

    @hawktang
    Author

    Confirmed — PR #6885 resolves both parts of #6884 on our end. I reviewed the diff and ran its targeted tests locally (6 passed), then verified the actual multipart cases with a leading file part and with a provider placeholder before the user's question. The query now includes all non-empty text parts, and retrieval failures are emitted through the google_adk.* module logger while preserving fail-open behavior. Thanks!

  6. removed
    request clarification
    on Aug 27, 2026
  7. added a commit that references this issue on Sep 14, 2026
    82687cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions