fix(adk): session query/manage APIs accept an explicit user_id#108
Open
shoom1 wants to merge 1 commit into
Open
fix(adk): session query/manage APIs accept an explicit user_id#108shoom1 wants to merge 1 commit into
shoom1 wants to merge 1 commit into
Conversation
Review finding 5 (countered): process() accepts arbitrary user_id and the job-resume path threads record.user_id, but session_exists/list_sessions/ delete_session/recent_messages hard-coded settings.default_user — sessions created for another user were unreachable through the framework API. Add keyword-only user_id (default: settings.default_user) to the four methods. Deliberately NOT the reviewer's typed (app_name, user_id, session_id) identity: ADK's session service already namespaces by exactly that tuple, the shipped CLI is single-user (message_processor always passes default_user), and the LangGraph half targets a backend slated for retirement. Claude-Session: https://claude.ai/code/session_01SwkKXQpy3JLEqrPkQA8QRv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review finding 5, countered
The finding is technically correct:
process()accepts arbitraryuser_id(and job-resume threadsrecord.user_id), whilesession_exists/list_sessions/delete_session/recent_messageshard-codedsettings.default_user— sessions created for a non-default user were unreachable through the framework API.But the proposed fix (a required typed
(app_name, user_id, session_id)identity across all processing and session methods) is over-engineering here: ADK's session service already namespaces by exactly that tuple internally, and the shipped CLI is single-user —message_processorpassessettings.default_usereverywhere, so no current caller can hit the mismatch. The LangGraphthread_idhalf of the finding targets a backend slated for retirement and is deliberately not addressed.Change
Keyword-only
user_id: str | None = None(defaulting tosettings.default_user) on the four ADK session methods. Existing callers are untouched; multi-user library consumers can now manage the sessions they create.Tests
TDD: seeded sessions under two users against a real sqlite
DatabaseSessionService; asserts default scope stays unchanged, explicit scope reaches the other user's session through all four APIs, and cross-user operations don't leak. Full offline suite: 1982 passed.https://claude.ai/code/session_01SwkKXQpy3JLEqrPkQA8QRv