FirestoreSessionService ignores `app:` / `user:` state prefixes, so app and user state are never shared across sessions
維護者通常 2 天內回覆
評估
研究方向
Start with appendEvent in contrib/firestore-session-service's FirestoreSessionService.java (prefix split around L657-L689, removal check at L666), then getSession (around L262-L272), and compare with InMemorySessionService.java appendEvent (L316-L338) and mergeWithGlobalState (L398). Run the module's existing mocked tests to see how app-state and user-state writes are asserted. Done means app: and user: keys are shared across sessions and merged on read, temp: keys are not persisted, and State.REMOVED deletes the key.
由索引模型根據 Issue 內容生成。
描述
🔴 Required Information
Describe the Bug:
FirestoreSessionService does not implement ADK's scoped state. ADK's State class defines app:, user: and temp: prefixes (State.APP_PREFIX, USER_PREFIX, TEMP_PREFIX), and InMemorySessionService stores app:/user: keys in shared app/user stores and merges them back into every session. FirestoreSessionService behaves differently:
appendEventonly routes keys starting with_app_/_user_to theapp-state/user-statecollections. Keys written through the normal ADK API (app:theme,user:name) fall through to the per-sessionstatefield, so they are only visible in that one session.- The
app-stateanduser-statecollections are write-only.getSession,createSessionandlistSessionsnever read them, so even a value stored under_app_/_user_never reaches another session. temp:keys are persisted in the session document.BaseSessionService.appendEventskips them.- Removal checks
value == null, but ADK marks removals with theState.REMOVEDsentinel, so a removed key is kept and the sentinel object is written to the session'sstatemap instead of the key being deleted.
Code references (main @ 189d463):
contrib/firestore-session-service/.../FirestoreSessionService.javaappendEvent(prefix split around L657-L689, removal check L666)getSessionbuilds the session only from the session document'sstatefield (around L262-L272)- Compare
core/.../InMemorySessionService.javaappendEvent(L316-L338) andmergeWithGlobalState(L398)
Steps to Reproduce:
- Configure a runner with
FirestoreSessionService. - In session A, a tool or callback sets
context.state().put("user:name", "Jae"). - Create session B for the same app and user, and read
user:name.
The same can be shown with the module's existing mocked tests (no Firestore needed): appending an event with state delta {"app:theme": "dark", "user:name": "Jae"} never calls set on the app-state / user-state documents, and the session document is updated with state = {app:theme=dark, user:name=Jae}. Appending {"temp:scratch": "x", "gone": State.REMOVED} writes both temp:scratch and the REMOVED sentinel into the session's state.
Expected Behavior:
Same semantics as InMemorySessionService (and the Python ADK database session services): app: keys shared by all sessions of the app, user: keys shared by all sessions of the app and user, merged back into Session.state() on getSession / createSession / listSessions, temp: keys not persisted, and State.REMOVED deleting the key.
Observed Behavior:
In session B, user:name is missing. App/user state behaves like session state. temp: values persist, and removed keys are not deleted.
Environment Details:
- ADK Library Version: main @ 189d463 (1.11.1-SNAPSHOT),
google-adk-firestore-session-service - OS: Linux
- TS Version: N/A
Model Information:
- N/A (session service bug, model independent)
🟡 Optional Information
Regression: No. The _app_ / _user_ handling has been there since the Firestore service was added.
Additional Context:
A fix would (a) split on State.APP_PREFIX / State.USER_PREFIX, (b) merge the app-state / user-state documents back into the session state with the prefixes on read, (c) skip State.TEMP_PREFIX, and (d) treat State.REMOVED as a delete (FieldValue.delete() in the shared stores). Existing data stored under _app_ / _user_ keys (if anyone relied on that convention) may need a note in the changelog. I'm happy to send a PR if this direction looks right.
- 主要語言
- Java
- 星號
- 1.8k
- 分支
- 440
- 平均合併
- 5 天 12 小時
- 30 天內合併 PR
- 75
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
google/adk-java 的其他 Issue
-
GeminiUtil placeholder user turn ("Continue output. DO NOT look at this line ...") is flagged by prompt injection filters可能已有人在做 @hemasekhar-p 於 17 天前認領。 未關閉needs review
難度 2/5 1-3 小時 新手友好度 76/100
google/adk-java#1628 · 1 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
[spring-ai] Streaming responses ending with CJK punctuation (。!?) are misclassified as partial and never persisted to the session可能已有人在做 @hirematha 於 20 天前認領。 未關閉needs review
難度 2/5 1-3 小時 新手友好度 84/100
google/adk-java#1608 · 3 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
McpToolset hangs silently for ~5 minutes per retry (3 retries) when stdio command is an npm shim ("npx") on Windows可能已有人在做 @hemasekhar-p 於 3 天前認領。 未關閉needs review
google/adk-java#1686 · 4 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
runLive passes partial events to appendEvent and never aggregates text chunks, unlike ADK Python可能已有人在做 @hemasekhar-p 於 13 天前認領。 未關閉needs review
難度 4/5 3-5 天 新手友好度 45/100
google/adk-java#1648 · 3 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
FirestoreSessionService compares event timestamps as text, reordering or skipping same-second events可能已有人在做 @hemasekhar-p 於 13 天前認領。 未關閉needs review
難度 3/5 1-2 天 新手友好度 50/100
google/adk-java#1646 · 3 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
AllTheMods/AllTheModium#238 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
apache/stormcrawler#2264 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
commons-app/apps-android-commons#7115 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
objectionary/lints#1596 ·
維護者通常 2 天內回覆