Show immediate BTW footer feedback

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Charles Cunningham
2026-03-25 00:15:45 -07:00
co-authored by Codex
parent d85f889894
commit 32d589880e
8 changed files with 72 additions and 0 deletions
+6
View File
@@ -180,6 +180,8 @@ impl App {
if self.current_displayed_thread_id() == Some(parent_thread_id) {
self.chat_widget.rollout_path()
} else {
self.chat_widget
.set_thread_footer_hint_override(/*items*/ None);
self.chat_widget.add_error_message(format!(
"Failed to fork BTW thread from {parent_thread_id}: {err}"
));
@@ -189,6 +191,8 @@ impl App {
}
.filter(|path| path.exists());
let Some(parent_rollout_path) = parent_rollout_path else {
self.chat_widget
.set_thread_footer_hint_override(/*items*/ None);
self.chat_widget.add_error_message(
"A thread must contain at least one turn before /btw can fork it.".to_string(),
);
@@ -255,6 +259,8 @@ impl App {
}
}
Err(err) => {
self.chat_widget
.set_thread_footer_hint_override(/*items*/ None);
let path_display = parent_rollout_path.display();
self.chat_widget.add_error_message(format!(
"Failed to start BTW thread from {path_display}: {err}"
+5
View File
@@ -4970,6 +4970,11 @@ impl ChatWidget {
let Some(user_message) = self.prepare_inline_submission_user_message() else {
return;
};
self.set_thread_footer_hint_override(Some(vec![(
"BTW".to_string(),
"starting...".to_string(),
)]));
self.request_redraw();
self.app_event_tx.send(AppEvent::StartBtw {
parent_thread_id,
user_message,
@@ -0,0 +1,12 @@
---
source: tui/src/chatwidget/tests.rs
assertion_line: 6666
expression: terminal.backend()
---
" "
"• Working (0s • esc to interrupt) "
" "
" "
"› Ask Codex to do anything "
" "
" BTW starting... 100% context left "
+15
View File
@@ -6620,10 +6620,14 @@ async fn slash_rename_with_args_is_rejected_for_btw_threads() {
#[tokio::test]
async fn slash_btw_requests_forked_side_question_while_task_running() {
use ratatui::Terminal;
use ratatui::backend::TestBackend;
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
let parent_thread_id = ThreadId::new();
chat.thread_id = Some(parent_thread_id);
chat.on_task_started();
chat.show_welcome_banner = false;
chat.bottom_pane.set_composer_text(
"/btw explore the codebase".to_string(),
Vec::new(),
@@ -6652,6 +6656,17 @@ async fn slash_btw_requests_forked_side_question_while_task_running() {
"expected no op on the parent thread"
);
assert_eq!(chat.bottom_pane.composer_text(), "");
let width = 80;
let height = chat.desired_height(width);
let mut terminal = Terminal::new(TestBackend::new(width, height)).expect("create terminal");
terminal
.draw(|f| chat.render(f.area(), f.buffer_mut()))
.expect("draw BTW footer");
assert_snapshot!(
"slash_btw_requests_forked_side_question_while_task_running",
terminal.backend()
);
}
#[tokio::test]
+2
View File
@@ -231,6 +231,8 @@ impl App {
}
}
Err(err) => {
self.chat_widget
.set_thread_footer_hint_override(/*items*/ None);
self.chat_widget.add_error_message(format!(
"Failed to fork BTW thread from {parent_thread_id}: {err}"
));
@@ -5089,6 +5089,11 @@ impl ChatWidget {
let Some(user_message) = self.prepare_inline_submission_user_message() else {
return;
};
self.set_thread_footer_hint_override(Some(vec![(
"BTW".to_string(),
"starting...".to_string(),
)]));
self.request_redraw();
self.app_event_tx.send(AppEvent::StartBtw {
parent_thread_id,
user_message,
@@ -0,0 +1,12 @@
---
source: tui_app_server/src/chatwidget/tests.rs
assertion_line: 7306
expression: terminal.backend()
---
" "
"• Working (0s • esc to interrupt) "
" "
" "
"› Ask Codex to do anything "
" "
" BTW starting... 100% context left "
@@ -7261,10 +7261,14 @@ async fn submit_user_message_as_plain_user_turn_does_not_run_shell_commands() {
#[tokio::test]
async fn slash_btw_requests_forked_side_question_while_task_running() {
use ratatui::Terminal;
use ratatui::backend::TestBackend;
let (mut chat, mut rx, mut op_rx) = make_chatwidget_manual(None).await;
let parent_thread_id = ThreadId::new();
chat.thread_id = Some(parent_thread_id);
chat.on_task_started();
chat.show_welcome_banner = false;
chat.bottom_pane.set_composer_text(
"/btw explore the codebase".to_string(),
Vec::new(),
@@ -7292,6 +7296,17 @@ async fn slash_btw_requests_forked_side_question_while_task_running() {
op_rx.try_recv().is_err(),
"expected no op on the parent thread"
);
let width = 80;
let height = chat.desired_height(width);
let mut terminal = Terminal::new(TestBackend::new(width, height)).expect("create terminal");
terminal
.draw(|f| chat.render(f.area(), f.buffer_mut()))
.expect("draw BTW footer");
assert_snapshot!(
"slash_btw_requests_forked_side_question_while_task_running",
terminal.backend()
);
}
#[tokio::test]