Skip to content

Scope Vertex RAG memory display names#5295

Open
petrmarinec wants to merge 1 commit intogoogle:mainfrom
petrmarinec:fix/vertex-rag-memory-scope
Open

Scope Vertex RAG memory display names#5295
petrmarinec wants to merge 1 commit intogoogle:mainfrom
petrmarinec:fix/vertex-rag-memory-scope

Conversation

@petrmarinec
Copy link
Copy Markdown

Summary

Fixes #5294.

This PR tightens VertexAiRagMemoryService memory scoping by replacing the ambiguous dot-delimited RAG display_name format with an encoded v1 format for new uploads. Search results are now parsed into exact app_name, user_id, and session_id components before being accepted.

The change also keeps compatibility for old unambiguous legacy display names in the exact app.user.session form, while ignoring ambiguous legacy names that contain extra dot-delimited components.

Why

The previous client-side filter used:

context.source_display_name.startswith(f"{app_name}.{user_id}.")

That can collide for IDs such as alice and alice.smith, allowing memory stored under demo.alice.smith.* to pass a lookup for demo / alice.

Tests

PYTHONPATH=src python -m pytest tests/unittests/memory -q
42 passed, 2 warnings

python -m isort --check-only src/google/adk/memory/vertex_ai_rag_memory_service.py tests/unittests/memory/test_vertex_ai_rag_memory_service.py
passed

python -m pyink --check --config pyproject.toml src/google/adk/memory/vertex_ai_rag_memory_service.py tests/unittests/memory/test_vertex_ai_rag_memory_service.py
passed

git diff --check -- src/google/adk/memory/vertex_ai_rag_memory_service.py tests/unittests/memory/test_vertex_ai_rag_memory_service.py
passed

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective.
  • New and existing unit tests pass locally with my changes.

@adk-bot adk-bot added the services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc label Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

services [Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid dotted ID collisions in VertexAiRagMemoryService memory lookups

2 participants