Fix TUI status visibility around streamed output (#33105)

## What changed

- Hide the working-status indicator when finalized assistant output is committed to the transcript, including single-line final answers.
- Restore the indicator when image generation begins during a running task after its streamed preamble has been flushed.

## Testing

- Add snapshot coverage for a single-line final answer and for image generation following a single-line preamble.

GitOrigin-RevId: e294a11cda3f0ce46f2bbed1be2a1380c9c73085
This commit is contained in:
rakan-oai authored and copyberry committed 2026-07-14 16:29:54 +00:00
1 parent effd58d750
commit fca8c00f11
6 files changed
+96

No files matched your search

@@ -877,6 +877,30 @@ async fn view_image_tool_call_preserves_foreign_path() {
assert_chatwidget_snapshot!("foreign_image_attachment_history_snapshot", combined);
}
#[tokio::test]
async fn image_generation_begin_restores_working_status_after_single_line_preamble() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.on_task_started();
chat.on_agent_message_delta("Generating an image.".to_string());
chat.on_image_generation_begin();
assert!(chat.bottom_pane.is_task_running());
assert!(chat.bottom_pane.status_indicator_visible());
let width: u16 = 80;
let height = chat.desired_height(width);
let mut terminal = ratatui::Terminal::new(ratatui::backend::TestBackend::new(width, height))
.expect("create terminal");
terminal
.draw(|frame| chat.render(frame.area(), frame.buffer_mut()))
.expect("draw image generation status");
assert_chatwidget_snapshot!(
"image_generation_begin_restores_working_status",
normalized_backend_snapshot(terminal.backend())
);
}
#[tokio::test]
async fn image_generation_call_adds_history_cell() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;