Skip to content

feat(acp): multi-session support with LRU eviction and session persistence#817

Merged
bug-ops merged 5 commits intomainfrom
epic/acp-session-lifecycle
Feb 24, 2026
Merged

feat(acp): multi-session support with LRU eviction and session persistence#817
bug-ops merged 5 commits intomainfrom
epic/acp-session-lifecycle

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 24, 2026

Summary

  • Configurable max_sessions (default 4) with LRU eviction of idle sessions
  • Background idle reaper task (60s tick) removes sessions past session_idle_timeout_secs (default 30 min)
  • Session persistence to SQLite (acp_sessions + acp_session_events tables)
  • load_session replays conversation history as session/update notifications per ACP spec
  • Evicted sessions remain loadable from SQLite
  • Database errors not leaked to ACP clients

Changes

File Change
crates/zeph-core/src/config/types.rs max_sessions, session_idle_timeout_secs in AcpConfig
crates/zeph-core/src/config/env.rs ZEPH_ACP_MAX_SESSIONS, ZEPH_ACP_SESSION_IDLE_TIMEOUT_SECS
crates/zeph-acp/src/agent.rs LRU eviction, idle reaper, persistence, load_session replay
crates/zeph-acp/src/transport.rs Config wiring through AcpServerConfig
crates/zeph-acp/Cargo.toml zeph-memory dependency
crates/zeph-memory/migrations/013_acp_sessions.sql New tables
crates/zeph-memory/src/sqlite/acp_sessions.rs CRUD methods for ACP sessions
src/main.rs, src/init.rs Wire store and config

Test plan

  • 2570 tests passed, 0 failed (+16 new)
  • cargo clippy --workspace -- -D warnings: 0 warnings
  • cargo +nightly fmt --check: clean
  • LRU eviction tests (oldest idle evicted, all-busy rejects)
  • SQLite CRUD tests (create, save events, load, delete, exists)
  • Config snapshot updated with new fields

Deferred items (tracked)

  • Session ownership check for load_session (SEC-01) — N/A until HTTP transport
  • Rate limiting on new_session (SEC-02) — low risk on stdio
  • SQLite growth cap (SEC-03) — acceptable at max_sessions=4
  • Batch event persistence (PERF-01) — post-MVP optimization

Closes #781, closes #782
Part of Epic #778

…tence

Configurable max_sessions (default 4) with LRU eviction of idle sessions
and background reaper task for idle timeout cleanup. Sessions persist
conversation history to SQLite (acp_sessions + acp_session_events tables)
and replay on load_session as session/update notifications per ACP spec.

Evicted sessions remain loadable from SQLite. Database errors are not
leaked to ACP clients; agent loop is only spawned after successful
event loading.

Closes #781, closes #782
@bug-ops bug-ops added this to the ACP Phase 2 milestone Feb 24, 2026
@bug-ops bug-ops added enhancement New feature or request acp Agent Client Protocol integration labels Feb 24, 2026
@github-actions github-actions bot added documentation Improvements or additions to documentation memory Persistence and memory rust core dependencies size/XL labels Feb 24, 2026
Add multi-session support, LRU eviction, SQLite persistence,
session resume, and idle reaper to docs, READMEs, and config reference.
@bug-ops bug-ops enabled auto-merge (squash) February 24, 2026 16:22
@bug-ops bug-ops merged commit d84dae8 into main Feb 24, 2026
23 checks passed
@bug-ops bug-ops deleted the epic/acp-session-lifecycle branch February 24, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acp Agent Client Protocol integration core dependencies documentation Improvements or additions to documentation enhancement New feature or request memory Persistence and memory rust size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session persistence and conversation replay on load Multi-session support with configurable limits and cleanup

1 participant