Skip to content

fix(sessions): trim session id before the in-memory duplicate check - #6891

Open
leilei3167 wants to merge 1 commit into
google:mainfrom
leilei3167:fix/in-memory-create-session-trim-id
Open

fix(sessions): trim session id before the in-memory duplicate check#6891
leilei3167 wants to merge 1 commit into
google:mainfrom
leilei3167:fix/in-memory-create-session-trim-id

Conversation

@leilei3167

Copy link
Copy Markdown

InMemorySessionService.create_session() checked the raw session_id for duplicates, then stripped it and stored under the trimmed key. A whitespace-padded id (order-42\n) therefore overwrote the existing session instead of raising AlreadyExistsError.

Trim the id first, then check — the same order sqlite and per_agent_database already use. Two contract tests cover padded and blank ids. database and redis still store ids as-is, so those cases are recorded as divergences.

Fixes #6887

Testing: pytest tests/unittests/sessions/test_session_service.py — 258 passed, 6 xfailed.

create_session checked the raw id, then stripped it and stored under the
trimmed key, so a padded id overwrote the existing session. Normalize
first, matching sqlite.

Fixes google#6887
@google-cla

google-cla Bot commented Aug 25, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants