research: auto-transition processing → reviewing on last run
Hooks the topology_worker's post-terminal path into a new notify_run_completed repo helper that atomically transitions the topic processing → reviewing when the completed run has research_topic_id set AND no siblings for that topic are still queued or running. Guarded on status='processing' so a retry, a re-fire, or a topic already past processing are all no-ops. Best-effort at the worker; DB hiccups are logged and never fail the run. The manual /submit-review endpoint stays as an escape hatch for topics that end up parked in processing with nothing to complete (updated the doc comment).
This commit is contained in:
@@ -244,9 +244,10 @@ pub async fn start_topic(
|
||||
}
|
||||
|
||||
/// `POST /api/research/:id/submit-review` — flips status `processing → reviewing`.
|
||||
/// v1 is caller-driven: the UI hits this when the human is happy with the
|
||||
/// runs' output. A later commit hooks this from the orchestrator on the
|
||||
/// last topology_run's completion.
|
||||
/// Kept as a manual escape hatch: the orchestrator auto-transitions on the
|
||||
/// last topology_run's completion (see topology_worker's
|
||||
/// `notify_run_completed` hook), so callers only need this when there are
|
||||
/// no runs (e.g. a topic parked in `processing` with nothing in flight).
|
||||
pub async fn submit_review(
|
||||
State(state): State<AppState>,
|
||||
Authed(user): Authed,
|
||||
|
||||
Reference in New Issue
Block a user