Condense TUI startup warnings (#42609)

## What changed

- Coalesce configuration, skill, sandbox, and MCP startup diagnostics into a single summary below the session header, including MCP and sign-in counts.
- Keep the complete warning text in the transcript and update the summary's transcript shortcut when key bindings change.
- Continue rendering warnings that arrive after work begins as inline history entries.
- Hide the MCP startup status row before a turn while preserving the configured interrupt shortcut.

## Testing

- Add coverage for warning ordering and deduplication, transcript details, MCP sign-in counts, resumed sessions, runtime warnings, reflow, backtracking, and interruption without a visible status row.

GitOrigin-RevId: 009657cf04f1d3a52270cf096eebf9db7513c040
This commit is contained in:
Ian MacLeod authored and copyberry committed 2026-09-03 20:25:59 +00:00
1 parent ed391d4dd2
commit 32c303c197
31 files changed
+728 -69

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
//! Coalesces startup diagnostics directly below the session splash.
use super::*;
use crate::history_cell::StartupWarningsCell;
impl App {
pub(super) fn merge_startup_warnings(
&mut self,
tui: &mut tui::Tui,
incoming: &StartupWarningsCell,
) {
let existing = self
.transcript_cells
.iter()
.position(|cell| cell.as_any().is::<StartupWarningsCell>());
let mut warnings = existing
.map(|index| self.transcript_cells.remove(index))
.and_then(|cell| cell.as_any().downcast_ref::<StartupWarningsCell>().cloned())
.unwrap_or_default();
for message in &incoming.messages {
if !warnings.messages.contains(message) {
warnings.messages.push(message.clone());
}
}
warnings
.other_sources
.extend(incoming.other_sources.iter().cloned());
warnings
.mcp_servers
.extend(incoming.mcp_servers.iter().cloned());
// The final MCP summary must retain the individual diagnostics' sign-in subset.
warnings
.sign_in_servers
.extend(incoming.sign_in_servers.iter().cloned());
if warnings.messages.is_empty() {
return;
}
warnings.transcript_hint = crate::keymap::primary_binding(&self.keymap.app.open_transcript)
.map(|binding| binding.display_label());
let header = self
.transcript_cells
.iter()
.rposition(|cell| cell.as_any().is::<history_cell::SessionInfoCell>());
warnings.pending_header = header.is_none() && self.chat_widget.thread_id().is_none();
let ready_to_render = !warnings.pending_header;
self.transcript_cells
.insert(header.map_or(0, |index| index + 1), Arc::new(warnings));
if let Some(Overlay::Transcript(overlay)) = &mut self.overlay {
overlay.replace_cells(self.transcript_cells.clone());
}
if self.backtrack.overlay_preview_active {
self.apply_backtrack_selection_internal(self.backtrack.nth_user_message);
}
if ready_to_render {
if let Some(buffer) = self.initial_history_replay_buffer.as_mut() {
buffer.retained_lines.clear();
buffer.render_from_transcript_tail = true;
return;
}
self.schedule_immediate_resize_reflow(tui);
if let Err(error) =
self.maybe_run_resize_reflow(tui, tui.terminal.last_known_screen_size)
{
tracing::warn!(%error, "failed to refresh startup warnings");
}
}
}
}