Files
codex/codex-rs/tui/src/bottom_pane/warnings.rs
T
Eric Traut 27065a91cc Allow restarting managed background servers from the TUI (#53173)
## Why

Startup configuration warnings can reflect settings from when the background server started, even after those settings have been fixed. A restart lets users refresh the server without leaving the TUI.

## What changed

- Add a confirmed restart action to `/daemon`, warning that active or queued work in other chats may be interrupted. Reconnect automatically and let an in-progress restart finish if the TUI exits.
- Verify that Codex manages a local server before enabling restart, including servers discovered with auto-start disabled and those started by `codex agents`.
- Show a restart hint on the first startup configuration warning for managed servers, preserving the original diagnostic for copying and dismissal.
- Repaint the full surface of centered dialogs to restore background colors over cached blank cells.

## Testing

Add CLI integration coverage for agents startup and restarting a discovered daemon with auto-start disabled. Extend TUI tests for confirmation, cancellation, unmanaged servers, warning hints and dismissal, and dialog background rendering.

GitOrigin-RevId: 8e4319fab84f13bf6e7335deb93364fccaff14a7
2026-10-11 17:43:08 +00:00

39 lines
1.2 KiB
Rust

//! Warning-panel ownership and focus routing; the ordinary composer is never replaced.
use super::*;
use crate::history_cell::WarningEntry;
use std::sync::Arc;
impl BottomPane {
pub(crate) fn show_warnings(
&mut self,
entries: Vec<WarningEntry>,
transcript: Arc<()>,
daemon_restart_hint_at: Option<usize>,
) {
let mut view = warnings_view::WarningsView::new(
entries,
transcript,
self.keymap.clone(),
self.app_event_tx.clone(),
);
view.daemon_restart_hint_at = daemon_restart_hint_at;
self.warnings_view = Some(view);
self.record_composer_activity_at(Instant::now());
self.request_redraw();
}
pub(crate) fn warnings_active(&self) -> bool {
self.warnings_view.is_some()
&& self.view_stack.is_empty()
&& !self
.questions
.as_ref()
.is_some_and(|questions| questions.expanded)
}
pub(crate) fn warning_notice_contains(&self, position: ratatui::layout::Position) -> bool {
self.no_modal_or_popup_active() && self.composer.warning_notice_contains(position)
}
}