Files
turnstone/tests
Patrick Buckley 5c452a1239 Harden session persistence: config storage, interrupted repair, prune… (#4)
* Harden session persistence: config storage, interrupted repair, prune tests

Session config persistence:
- Add session_config table to SQLite schema for persisting LLM-affecting
  parameters (temperature, reasoning_effort, max_tokens, instructions,
  creative_mode) across resume
- Add save_session_config() and load_session_config() to memory.py
- ChatSession._save_config() called on init and when /instructions,
  /effort, /creative slash commands change config
- resume_session() restores persisted config and rebuilds system messages

Interrupted session repair:
- load_session_messages() now strips trailing incomplete tool call turns
  where tool_calls exist but fewer tool results than expected (session
  was interrupted mid-execution via Ctrl+C or crash)

Cleanup:
- delete_session() now also removes session_config rows
- 14 new tests: interrupted repair (4), config persistence (5),
  prune_sessions (5)

Docs & diagrams:
- Document config persistence and interrupted repair in architecture.md
- Add _save_config() to ChatSession in 03-core-engine-classes.puml

* Fix Copilot PR #4 review: prune config cleanup, /new config persist, resume instructions

- prune_sessions() now deletes session_config rows for orphaned/stale sessions
- /new command calls _save_config() so config persists immediately
- resume_session() uses key presence check for instructions, fixing cross-session leak
- Add test_prune_removes_session_config covering both orphan and stale paths
2026-03-02 18:14:33 -08:00
..