# Todo 31: Runtime Persistence ## Status done ## Goal Persist live WebSocket runtime data into the SQLite session store so completed turns can be replayed through the REST APIs. ## Scope - Add an optional `session_id` to `DebugRunRequest`. - Let the WebSocket runtime create or reuse a persisted session. - Persist Agent config snapshots when a session is created or reused. - Persist user and assistant messages for each turn. - Persist audit entries with turn and round indexes. - Persist one usage row per ChatAgent model call. - Continue turn indexes for an existing persisted session. ## Verification - Runtime tests prove session creation, turn/message persistence, audit rows, usage rows, and existing-session turn indexes. - Existing queue, audit, WebSocket, and store tests still pass. - `uv run pytest tests/test_sqlite_store.py tests/test_debug_runtime.py tests/test_websocket_api.py -q` passes: 55 tests. - `uv run pytest` passes: 66 tests.