Skip to content

fix(session state): implement optimistic locking and collision retries for session concurrency - #18

Merged
junxiant merged 3 commits into
mainfrom
fix/session-concurrency
Sep 11, 2026
Merged

junxiant merged 3 commits into
mainfrom
fix/session-concurrency

Conversation

@junxiant

Copy link
Copy Markdown
Owner
  • Add version column and idx_sessions_updated_at index to sessions table in Postgres and SQLite
  • Add automatic schema migration in _init_db_once for existing databases
  • Introduce SessionConcurrencyError and conditional updates on matching version
  • Add collision retry loop with backoff and fresh dialogue merging in record_turn()
  • Implement delete_expired_sessions(ttl_days=30) for future automated cleanup
  • Add test coverage for collision detection, parallel turn merging, and TTL cleanup
  • Document session state concurrency improvements in CHANGES.md

…ssion concurrency

- Add version column and idx_sessions_updated_at index to sessions table in Postgres and SQLite
- Add automatic schema migration in _init_db_once for existing databases
- Introduce SessionConcurrencyError and conditional updates on matching version
- Add collision retry loop with backoff and fresh dialogue merging in record_turn()
- Implement delete_expired_sessions(ttl_days=30) for automated database cleanup
- Add test coverage for collision detection, parallel turn merging, and TTL cleanup
- Document session state concurrency improvements in CHANGES.md
@junxiant
junxiant merged commit 56d19fa into main Sep 11, 2026
0 of 2 checks passed
@junxiant
junxiant deleted the fix/session-concurrency branch September 11, 2026 06:54
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.

1 participant