Fix agent run completion and follow-up handling

Ensure parallel tool results finish before follow-ups, preserve warping
status across exchanges, clean up streams before crosscheck reviews, and
restore terminal focus when conversations complete. Remove temporary
debug
logging.
This commit is contained in:
Ryan Ward
2026-07-31 16:33:08 -05:00
parent 7f4891ec7c
commit d9cf0d8ae3
7 changed files with 84 additions and 87 deletions
+10 -7
View File
@@ -1317,23 +1317,26 @@ impl BlocklistAIActionModel {
.or_default()
.push(action_result);
ctx.emit(BlocklistAIActionEvent::FinishedAction {
action_id,
conversation_id,
cancellation_reason,
});
if self
.running_actions
.get(&conversation_id)
.is_some_and(|running| !running.is_empty())
{
// Wait until the entire phase drains before scheduling subsequent actions or deciding
// whether to send a follow-up request.
// whether to send a follow-up request. In particular, don't emit `FinishedAction` yet:
// the controller treats that event as the phase-complete signal and could otherwise
// drain only a prefix of parallel tool results into the next LLM request.
return;
}
// The phase is fully drained — sort results back into original tool-call order.
// The phase is fully drained — sort results back into original tool-call order before
// notifying the controller that it may send the follow-up request.
self.sort_finished_results(conversation_id);
ctx.emit(BlocklistAIActionEvent::FinishedAction {
action_id,
conversation_id,
cancellation_reason,
});
if self
.pending_actions