Fix TUI input queue handling during MCP startup (#35957)

## Why

Pending MCP server startup can outlive an agent turn. Treating its shared
running indicator as an active user turn prevents queued follow-ups and slash
commands from advancing after the turn completes.

## What changed

- Allow the input queue to drain while only MCP startup remains active.
- Keep queued input blocked while a review, foreground shell command, or
  compaction is pending or running.
- Resume queue draining after session-selection flows close.

## Testing

Add TUI tests covering queued follow-ups, slash commands, reviews, shell
commands, and compaction while MCP startup is pending.

GitOrigin-RevId: f5684f61c32e3728ff71cf222f0486df637dc3a5
This commit is contained in:
jif authored and copyberry committed 2026-07-29 13:45:58 +00:00
1 parent 9a6668f674
commit e1895710ad
8 files changed
+197 -8

No files matched your search

+3
View File
@@ -80,6 +80,7 @@ impl App {
self.chat_widget.add_error_message(format!(
"Failed to start TUI session picker: {err}"
));
self.chat_widget.maybe_send_next_queued_input();
return Ok(AppRunControl::Continue);
}
};
@@ -112,6 +113,7 @@ impl App {
SessionSelection::Fork(_) => {}
}
self.chat_widget.maybe_send_next_queued_input();
// Leaving alt-screen may blank the inline viewport; force a redraw either way.
tui.frame_requester().schedule_frame();
}
@@ -229,6 +231,7 @@ impl App {
);
}
self.chat_widget.maybe_send_next_queued_input();
tui.frame_requester().schedule_frame();
}
AppEvent::ForkSessionForPromptEdit {