refactor: remove SessionStore, migrate to StorageProvider - #219
Closed
Million-mo wants to merge 4 commits into
Closed
refactor: remove SessionStore, migrate to StorageProvider#219Million-mo wants to merge 4 commits into
Million-mo wants to merge 4 commits into
Conversation
fastmcp 3.4.4 passes follow_redirects=True to httpx_client_factory, but our factory also passed it explicitly, causing 'httpx.AsyncClient() got multiple values for keyword argument' on MCP server initialization. Use kwargs.setdefault() so caller-provided value takes precedence.
Remove the deprecated SessionStore Protocol and MemorySessionStore class. All session persistence now uses StorageProvider/SessionPersistence. Changes: - Delete src/agentpool/sessions/store.py (SessionStore, MemorySessionStore) - Remove SessionStore re-export from sessions/__init__.py - Remove get_session_store() from StorageConfig and SQLStorageConfig - Fix MemoryStorageProvider.delete_session() to clean up checkpoints - Add no-op MemoryStorageProvider.update_sdk_session_id() override - Migrate 17 test files from MemorySessionStore to MemoryStorageProvider - Fix async with store: pattern in test_create_child_session.py (MemoryStorageProvider.cleanup() clears data on __aexit__) Closes #170
- Fix import sorting in test_acp_session_manager_child_session.py - Run ruff format on all test files (fixes consecutive spaces) - Remove deleted agentpool.sessions.store from import linter config - Remove duplicate # type: ignore[method-assign] in test_resume_concurrency.py
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.
Summary
Remove the deprecated
SessionStoreProtocol andMemorySessionStoreclass, migrating all session persistence toStorageProvider/SessionPersistence.Closes #170
Motivation
AgentPool had two coexisting session storage hierarchies:
SessionStore(deprecated,sessions/store.py) — 4-method Protocol with onlyMemorySessionStoreas implementationSessionPersistence(current,agentpool_storage/protocols.py) — 6-method Protocol backed byStorageProviderAll production code already used
SessionPersistence.SessionStorewas dead code — onlyMemorySessionStoresurvived as a config fallback and test fixture. This dual hierarchy caused confusion and maintenance burden.Changes
Production code
src/agentpool/sessions/store.py(SessionStore Protocol + MemorySessionStore class)SessionStorere-export fromsessions/__init__.py(keepSessionPersistence)get_session_store()fromStorageConfigandSQLStorageConfigMemoryStorageProvider.delete_session()to clean up checkpoints (was a bug —MemorySessionStoredid this butMemoryStorageProviderdidn't)MemoryStorageProvider.update_sdk_session_id()override (base class raisesNotImplementedError)Test migration (17 files)
Migrated all test files from
MemorySessionStoretoMemoryStorageProvider:from agentpool.sessions.store→from agentpool_storage.memory_provider.provider.save()→.save_session(),.load()→.load_session(),.delete()→.delete_session(),.list_sessions()→.list_session_ids()save_checkpoint3rd param nowstr(JSON-encoded),load_checkpointreturnstuple[str, str]list_sessions(parent_id=)→list_session_ids()+load_session()+ Python-side filter bySessionData.parent_idasync with store:pattern intest_create_child_session.py(MemoryStorageProvider.cleanup() clears data on exit)Verification
ruff check src/— all checks passedpytest— 192 passed, 1 skipped, 0 failures (across all 17 migrated test files)MemorySessionStoreoragentpool.sessions.storeinsrc/ortests/Breaking changes
SessionStoreProtocol andMemorySessionStoreclass removed (were already deprecated)StorageConfig.get_session_store()method removed (dead code)MemoryStorageProviderconstructor takesMemoryStorageConfig | None, not a path string