fix(engine): avoid redundant shell completion re-entry

Keep shell completion runtime messages available to the next turn without
forcing an extra model request when a tracked shell finishes during the
current turn. This preserves completion delivery while avoiding
timing-dependent token spend and platform-specific wiremock failures.

Verified: cargo fmt --all -- --check; the three engine regressions
(yolo_mode_does_not_prompt_for_background_shell,
operate_model_shell_uses_normal_approval_and_workspace_sandbox,
full_access_subagent_handoff_keeps_model_shell_free_of_approval_prompts)
3 passed / 0 failed; shell handoff unit test 1/1.
This commit is contained in:
Hmbown authored and Hunter B committed 2026-07-26 10:10:37 -07:00
1 parent 80348784ac
commit 03ece7d8b1
1 file changed
-4
-4
View File
@@ -1428,8 +1428,6 @@ impl Engine {
if let Some(status) = shell_completion_status_text(&shell_completions, "") {
let _ = self.tx_event.send(Event::status(status)).await;
}
turn.next_step();
continue;
}
// Sub-agent completion handoff (issue #756). The model finished
@@ -1597,8 +1595,6 @@ impl Engine {
{
let _ = self.tx_event.send(Event::status(status)).await;
}
turn.next_step();
continue;
}
if self.drain_subagent_completion_events("late").await > 0 {