InMemoryMemoryService loses sessionless memories when a session ID equals its fallback bucket name
维护者通常 4 天内回复
@llalitkumarrr 已经在做这个了。
开始于 2026年10月25日。
评估
调研方向
先阅读 InMemoryMemoryService.add_events_to_memory() 和 add_session_to_memory(),然后比较它们在 google/adk/memory/in_memory_memory_service.py 中处理会话 ID 的方式。使用提供的操作序列重现冲突,并检查现有的 memory service 测试。当添加 ID 为 __unknown_session_id__ 的会话后,无会话 ID 添加的记忆仍得到保留时,任务即完成。
由索引模型根据 Issue 内容生成。
描述
Required Information
Describe the Bug:
InMemoryMemoryService.add_events_to_memory() maps an omitted session ID to the string __unknown_session_id__. InMemorySessionService also accepts that literal as an ordinary session ID. Passing that session to add_session_to_memory() replaces the same bucket, silently removing previously added sessionless memories.
Steps to Reproduce:
- Add an event without a session ID and confirm it is searchable.
- Create an empty session with ID
__unknown_session_id__throughInMemorySessionService. - Add that session to memory and search again using the code below.
Expected Behavior:
Adding an unrelated empty session should preserve existing sessionless memories, as it does with ordinary-session.
Observed Behavior:
ordinary-session: before=1, after=1
__unknown_session_id__: before=1, after=0
Environment Details:
- ADK: source checkout of
mainat12c7bed7661ccf942f0f6d3b62bed22a23ea0a85. - Desktop OS: macOS, arm64.
- Python: 3.13.16.
Model Information:
- LiteLLM: No.
- Model: N/A; local memory/session services only.
Optional Information
Regression: Unknown; reproduced on current main.
Minimal Reproduction Code:
import asyncio
from google.adk.events import Event
from google.adk.memory.in_memory_memory_service import InMemoryMemoryService
from google.adk.sessions.in_memory_session_service import InMemorySessionService
from google.genai import types
async def run(session_id):
memory = InMemoryMemoryService()
await memory.add_events_to_memory(
app_name="app", user_id="user",
events=[Event(author="user", content=types.Content(
parts=[types.Part(text="saffron")]))],
)
before = len((await memory.search_memory(
app_name="app", user_id="user", query="saffron")).memories)
session = await InMemorySessionService().create_session(
app_name="app", user_id="user", session_id=session_id)
await memory.add_session_to_memory(session)
after = len((await memory.search_memory(
app_name="app", user_id="user", query="saffron")).memories)
print(f"{session_id}: before={before}, after={after}")
async def main():
await run("ordinary-session")
await run("__unknown_session_id__")
asyncio.run(main())
How often: Always for the sequence above.
Additional Context: This uses only public service methods, with no internal state mutation. The collision is within one app/user scope. The fallback bucket needs an identity that cannot alias a caller-provided session ID. No fix is included in this report.
- 主要语言
- Python
- 星标
- 22k
- 派生
- 4.2k
- 平均合并
- 3 天 21 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/adk-python 的其他 Issue
-
gen_ai.choice log reports gen_ai.system=gemini for OpenAI and Groq models through LiteLlm可能已有人在做 @llalitkumarrr 于 4 天前认领。 未关闭models
难度 2/5 1-3 小时 新手友好度 82/100
google/adk-python#7631 · 已指派 1 人 ·
维护者通常 4 天内回复
-
LiteLlm with SSE streaming records the answer twice in gen_ai.output.messages可能已有人在做 @surajksharma07 于 4 天前认领。 未关闭models
难度 2/5 1-3 小时 新手友好度 78/100
google/adk-python#7630 · 11 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
Update opentelemetry-api and opentelemetry-sdk to 1.44.0可能已有人在做 @llalitkumarrr 于 18 天前认领。 未关闭request clarification tracing
难度 2/5 1-3 小时 新手友好度 70/100
google/adk-python#7433 · 5 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
-
CI Mypy Check flags an existing streaming_utils.py error as new because the PR run reuses the baseline's mypy cache可能已有人在做 @DeanChensj 于 20 天前认领。 未关闭needs review
难度 2/5 1-3 小时 新手友好度 72/100
google/adk-python#7409 · 1 条评论 · 已指派 2 人 ·
维护者通常 4 天内回复
-
A2aAgentExecutor sends the raw exception text to the A2A caller when the run fails可能已有人在做 @sanketpatil06 于 21 天前认领。 未关闭a2a request clarification
难度 2/5 1-3 小时 新手友好度 84/100
google/adk-python#7385 · 2 条评论 · 已指派 1 人 ·
维护者通常 4 天内回复
查看 google/adk-python 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
521xueweihan/HelloGitHub#4115 ·
-
get_lldp_neighbors_detail: query asks for 'max-address' (typo for 'mac-address'), so remote_chassis_id is always empty可能已有人在做 @Jah-yee 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
-
lesson-submission pending-review
难度 1/5 1 小时以内 新手友好度 74/100
Ikalus1988/MisakaNet#3899 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
aws-samples/sample-per-model-bedrock#549 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100