Persist REST /api/ask via the shared incremental path#17
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the follow-up from #16.
What
POST /api/asknow persists the full consensus debate through the sameIncrementalPersisterused 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_consensusgains an additiveon_thread_createdcallback 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.db_factoryinto_run_consensus(persistence happens inside the run) and drops the now-dead_persist_resulthelper.Testing
TestPersistResult(which tested the removed helper) replaced withTestUnifiedPersistence: 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