Files
codex/codex-rs/tui/src/app/agents_overview_errors.rs
T
Eric Traut 516f2780fd Open new sessions directly from the command center (#45255)
## What changed

- Replace the inline task composer with a session list: `n` opens a blank session in the selected checkout without sending an initial turn or interrupting running agents.
- Use single-letter action shortcuts and `Enter` to open a session. `Esc` cancels search or rename without closing the list; `Ctrl+C` quits from the list.
- Load destination settings for new sessions while carrying over explicit permission choices. Retain blank sessions and their drafts across navigation until the first turn.

## Testing

Update tests and snapshots for command center navigation, shortcuts, blank draft restoration, destination defaults, permission carryover, and directory trust.

GitOrigin-RevId: bddd04fdbe6ac2f5b7bd70293fd04f673b97ba02
2026-09-13 16:14:41 +00:00

47 lines
1.4 KiB
Rust

//! Reports command-center action failures above the retained dashboard.
use super::*;
use crate::wrapping::word_wrap_lines;
use ratatui::buffer::Buffer;
struct AgentsOverviewErrorHeader(Vec<Line<'static>>);
impl Renderable for AgentsOverviewErrorHeader {
fn render(&self, area: Rect, buf: &mut Buffer) {
Renderable::render(
&Paragraph::new(word_wrap_lines(&self.0, usize::from(area.width))),
area,
buf,
);
}
fn desired_height(&self, width: u16) -> u16 {
word_wrap_lines(&self.0, usize::from(width)).len() as u16
}
}
impl App {
pub(in crate::app) fn add_agents_overview_error(&mut self, message: String) {
if self
.chat_widget
.selected_index_for_present_view(AGENTS_OVERVIEW_VIEW_ID)
.is_some()
{
let items = vec![SelectionItem {
name: "Return to command center".to_string(),
dismiss_on_select: true,
..Default::default()
}];
self.chat_widget.show_selection_view(SelectionViewParams {
header: Box::new(AgentsOverviewErrorHeader(vec![
Line::from("Unable to complete action".bold()),
Line::from(message.clone().dim()),
])),
items,
..Default::default()
});
}
self.chat_widget.add_error_message(message);
}
}