Conversation
Follow the base session service ordering contract and use user and session IDs to break timestamp ties. Remove the recorded ordering divergence and cover both user-scoped and app-wide lists.
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.
Description of Change
Problem:
RedisSessionService.list_sessions()returns sessions newest first, contrary to the base service contract. An application selectingresponse.sessions[-1]to resume its most recently active session instead selects an older session.Solution: Sort the shared result oldest first using
(last_update_time, user_id, id), matching the in-memory, SQLite and database implementations. Remove Redis's recorded ordering divergence from the shared contract tests, and cover both listing scopes and timestamp ties. The separate Redis timestamp-source and unknown-session append divergences remain unchanged.The activity-time order and user/session tie-breakers were established for the database backend in #6272. Redis's deviation is recorded in the shared test registry.
Reproduction
Environment details: Current source based on
322e3bf, ADK 2.9.0 package metadata, macOS 26.6.2 arm64, Python 3.12.10, Redis 8.4.0, redis-py 8.1.0.Model information: LiteLLM: No. Model: N/A (no model call).
Steps to reproduce:
redisin a virtual environment.REDIS_SOCKETto its path. For example,redis-server --port 0 --unixsocket /tmp/adk-order-example.sock --save "" --appendonly no, in a separate terminal.Observed behavior on main:
Expected behavior, verified after the correction:
Testing Plan
tests/unittests/plugins/test_bigquery_agent_analytics_plugin.py; all other hooks pass. The unrelated formatter change is excluded from this PR.tox -p 2completed the fulltests/unittestssuite on Python 3.10–3.14, with all five environments exiting 0. Each reports 14,839 passed (14,846 on 3.11), 86–87 skipped, 26 xfailed and 2 xpassed. Production source and the conformance registry were unchanged throughout; the final tie-fixture identifiers were verified separately in all five environments as reported above.Compatibility and Documentation
The method signature, response shape and stored data are unchanged. Redis callers that compensated for its previous returned order may need to remove that compensation.
This restores the documented oldest-first contract and changes Redis's previous returned order. Is normal bug-fix release handling sufficient, or should this also carry a migration note for callers that compensated for the old order?
Companion documentation clarifies the existing Python session-list contract in the session guide change.