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

+8
View File
@@ -1770,6 +1770,14 @@ impl ChatWidget {
}
pub(crate) fn prepare_local_op_submission(&mut self, op: &AppCommand) {
if matches!(
op,
AppCommand::Compact
| AppCommand::Review { .. }
| AppCommand::RunUserShellCommand { .. }
) {
self.input_queue.user_turn_pending_start = true;
}
if matches!(op, AppCommand::Interrupt) && self.turn_lifecycle.agent_turn_running {
if let Some(controller) = self.stream_controller.as_mut() {
controller.clear_queue();