Implement delta-save for session messages
Replace full DELETE/INSERT with efficient delta writes:
- Track db_message_count on Session (how many rows already persisted).
- On save(): UPDATE mutable flags for existing rows, DELETE only extras
  (race guard), INSERT new messages via executemany.
- Reduces DB write amplification from O(N) to O(delta) per turn.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 3b49293 commit cb22a1d3a10b68c0f1538c63fbaa7ee02b44f493
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored on 25 May
Showing 2 changed files
View
navi/core/pg_session_store.py
View
navi/core/session.py