Skip to content

Persist REST /api/ask via the shared incremental path#17

Merged
msitarzewski merged 1 commit into
mainfrom
feat/rest-unified-persistence
Jun 22, 2026
Merged

Persist REST /api/ask via the shared incremental path#17
msitarzewski merged 1 commit into
mainfrom
feat/rest-unified-persistence

Conversation

@msitarzewski

Copy link
Copy Markdown
Owner

Closes the follow-up from #16.

What

POST /api/ask now persists the full consensus debate through the same IncrementalPersister used by the CLI and WebSocket — all rounds, contributions, citations, decision, overview, follow-ups, and usage — instead of the lite path that saved only the final decision. A crash mid-request leaves a real partial thread instead of nothing.

How

  • _run_consensus gains an additive on_thread_created callback so REST can surface the thread ID the persister creates up front. This avoids changing the 8-tuple return, so the other 7 callers are untouched.
  • REST forwards its db_factory into _run_consensus (persistence happens inside the run) and drops the now-dead _persist_result helper.

Testing

  • 1663 Python tests pass, mypy clean (63 files), ruff clean.
  • TestPersistResult (which tested the removed helper) replaced with TestUnifiedPersistence: verifies REST forwards the factory and returns the persister's thread ID, and reports a null thread_id when no thread was created.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EkrekgzMAQko92UkjnXhHL

POST /api/ask now persists the full consensus debate (all rounds,
contributions, citations, decision, overview, follow-ups, usage) through
the same IncrementalPersister used by the CLI and WebSocket, replacing the
lite path that saved only the final decision. A crash mid-request now
leaves a real partial thread instead of nothing.

_run_consensus gains an additive on_thread_created callback so REST can
surface the thread ID the persister creates up front, without changing the
8-tuple return (no impact on the other callers). The now-dead
_persist_result helper is removed.

1663 Python tests pass, mypy + ruff clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EkrekgzMAQko92UkjnXhHL
@msitarzewski msitarzewski merged commit 249f664 into main Jun 22, 2026
3 checks passed
@msitarzewski msitarzewski deleted the feat/rest-unified-persistence branch June 22, 2026 03:22
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