VertexAiRagMemoryService drops distinct events that share a timestamp

Aperta
#8,209 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@sanketpatil06 ci sta già lavorando.

Dal 18/11/2026.

  • #8211 di @sumedh-aerram — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

services

search_memory loses distinct events from separate retrieved chunks of the same session when their timestamps match. _merge_event_lists uses timestamps for deduplication, although uploaded transcript lines also store author and text.

Expected: both the question and the answer containing ORCHID are returned, in order. Actual on upstream/main: only the question is returned. Exact copies from overlapping chunks should still appear once.

Offline reproduction (mocked RAG listing and retrieval; no credentials, model, or cloud service).

The final assertion fails on main:

import asyncio
import json
from types import SimpleNamespace as NS
from unittest.mock import AsyncMock, patch

from google.adk.memory.vertex_ai_rag_memory_service import VertexAiRagMemoryService


async def main():
    service = VertexAiRagMemoryService(rag_corpus="corpus")
    events = [("user", "What is the launch code?"),
              ("model", "The launch code is ORCHID.")]
    contexts = [NS(source_display_name="demo.alice.session", text=json.dumps({
        "author": author, "timestamp": 1700000000.0, "text": text,
    })) for author, text in events]
    client = NS(rag=NS(
        list_files=AsyncMock(side_effect=PermissionError("offline")),
        retrieve_contexts=AsyncMock(return_value=NS(contexts=NS(contexts=contexts))),
    ))
    with patch("agentplatform.Client", return_value=NS(aio=client)):
        response = await service.search_memory(
            app_name="demo", user_id="alice", query="launch code")
    actual = [(m.author, m.content.parts[0].text) for m in response.memories]
    print(actual)
    assert actual == events


asyncio.run(main())

Environment: ADK main (2.14.1), Python 3.11.17. Regression introduction unknown. Deterministic offline case.

Suggested fix: retain timestamp-based overlap grouping and stable ordering, but deduplicate using (timestamp, author, text). Parsed Event IDs are regenerated and cannot identify overlapping copies.

Lingua principale
Python
Stelle
22.3k
Fork
4.4k
Merge medio
1g 2h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/adk-python

Tutte le issue di google/adk-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.