Skip to content

refactor: remove SessionStore, migrate to StorageProvider - #219

Closed
Million-mo wants to merge 4 commits into
refactor/agentwolf_v1from
refactor/remove-sessionstore
Closed

refactor: remove SessionStore, migrate to StorageProvider#219
Million-mo wants to merge 4 commits into
refactor/agentwolf_v1from
refactor/remove-sessionstore

Conversation

@Million-mo

Copy link
Copy Markdown
Owner

Summary

Remove the deprecated SessionStore Protocol and MemorySessionStore class, migrating all session persistence to StorageProvider / SessionPersistence.

Closes #170

Motivation

AgentPool had two coexisting session storage hierarchies:

  1. SessionStore (deprecated, sessions/store.py) — 4-method Protocol with only MemorySessionStore as implementation
  2. SessionPersistence (current, agentpool_storage/protocols.py) — 6-method Protocol backed by StorageProvider

All production code already used SessionPersistence. SessionStore was dead code — only MemorySessionStore survived as a config fallback and test fixture. This dual hierarchy caused confusion and maintenance burden.

Changes

Production code

  • Delete src/agentpool/sessions/store.py (SessionStore Protocol + MemorySessionStore class)
  • Remove SessionStore re-export from sessions/__init__.py (keep SessionPersistence)
  • Remove get_session_store() from StorageConfig and SQLStorageConfig
  • Fix MemoryStorageProvider.delete_session() to clean up checkpoints (was a bug — MemorySessionStore did this but MemoryStorageProvider didn't)
  • Add no-op MemoryStorageProvider.update_sdk_session_id() override (base class raises NotImplementedError)

Test migration (17 files)

Migrated all test files from MemorySessionStore to MemoryStorageProvider:

  • Import changes: from agentpool.sessions.storefrom agentpool_storage.memory_provider.provider
  • API changes: .save().save_session(), .load().load_session(), .delete().delete_session(), .list_sessions().list_session_ids()
  • Checkpoint API: save_checkpoint 3rd param now str (JSON-encoded), load_checkpoint returns tuple[str, str]
  • list_sessions(parent_id=)list_session_ids() + load_session() + Python-side filter by SessionData.parent_id
  • Fix async with store: pattern in test_create_child_session.py (MemoryStorageProvider.cleanup() clears data on exit)

Verification

  • ruff check src/ — all checks passed
  • pytest — 192 passed, 1 skipped, 0 failures (across all 17 migrated test files)
  • Zero remaining references to MemorySessionStore or agentpool.sessions.store in src/ or tests/

Breaking changes

  • SessionStore Protocol and MemorySessionStore class removed (were already deprecated)
  • StorageConfig.get_session_store() method removed (dead code)
  • MemoryStorageProvider constructor takes MemoryStorageConfig | None, not a path string

备份迁移自 SRC-PR#180 · 作者 @Leoyzen · 创建于 2026-07-17T12:20:55Z · head=refactor/remove-sessionstore base=refactor/agentwolf_v1
源状态: merged · merge_commit_sha=94dc4b1640e9eea6d9610cac0a89a63a3e51d42a

Leoyzen added 4 commits July 17, 2026 19:19
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants