Show streaming reasoning summaries in the TUI status row (#43921)

## What changed

- Update the status heading from the latest usable reasoning line and retain it through tool activity and empty reasoning items. Keep completed reasoning in the expanded transcript only.
- Restore active reasoning after resume, thread switches, and session refreshes, including when earlier events have left the replay buffer.
- Default new embedded TUI threads to `model_reasoning_summary = "detailed"`, honoring explicit summary settings. Keep `concurrent_reasoning_summaries` opt-in and disable it when summaries are `none`.
- Persist the request's captured reasoning summary setting in context updates and local and remote compaction checkpoints.
- Animate status text with a smooth, grapheme-aware shimmer that respects terminal colors and reduced motion.

## Testing

Add regression coverage for reasoning status updates, transcript visibility, resume and buffered replay, outbound summary configuration, and summary settings across all three compaction modes. Add shimmer snapshots and checks for smooth brightness changes and Unicode grapheme preservation.

GitOrigin-RevId: 725c7de20f23166d7a3da6daeca617add5cbc600
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-09-08 21:41:02 +00:00
1 parent 78932f4493
commit 9ec33e1926
45 files changed
+1798 -90

No files matched your search

+4 -10
View File
@@ -1,4 +1,5 @@
//! User, assistant, reasoning, and streaming message history cells.
//! Completed reasoning is retained in the expanded transcript, not compact scrollback.
use super::markdown_render_cache::MarkdownRenderCache;
use super::*;
@@ -658,7 +659,8 @@ pub(crate) fn new_spoken_user_prompt(message: String) -> UserHistoryCell {
cell
}
/// Create the reasoning history cell emitted at the end of a reasoning block.
/// Retain a completed reasoning block in the expanded transcript only.
/// Activity headings belong to the live status row and must not accumulate in scrollback.
///
/// The helper snapshots `cwd` into the returned cell so local file links render the same way they
/// did while the turn was live, even if rendering happens after other app state has advanced. Part
@@ -669,16 +671,8 @@ pub(crate) fn new_reasoning_summary_block(
cwd: &Path,
) -> Box<dyn HistoryCell> {
let (header, content) = split_reasoning_summary_parts(&reasoning_parts);
let title_only = content
.strip_prefix("**")
.and_then(|content| content.strip_suffix("**"))
.is_some_and(|content| !content.is_empty() && !content.contains("**"));
let transcript_only = header.is_empty() && !title_only;
Box::new(ReasoningSummaryCell::new(
header,
content,
cwd,
transcript_only,
header, content, cwd, /*transcript_only*/ true,
))
}
+10 -13
View File
@@ -2670,7 +2670,7 @@ fn reasoning_summary_block() {
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
assert_eq!(rendered_display, vec!["• Detailed reasoning goes here."]);
assert_eq!(rendered_display, Vec::<String>::new());
let rendered_transcript = render_transcript(cell.as_ref());
assert_eq!(rendered_transcript, vec!["• Detailed reasoning goes here."]);
@@ -2742,7 +2742,7 @@ async fn reasoning_summary_block_respects_config_overrides() {
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
assert_eq!(rendered_display, vec!["• Detailed reasoning goes here."]);
assert_eq!(rendered_display, Vec::<String>::new());
}
#[test]
@@ -2776,17 +2776,14 @@ fn reasoning_summary_block_falls_back_when_summary_is_missing() {
}
#[test]
fn reasoning_summary_block_displays_title_only_summary() {
fn reasoning_summary_block_keeps_title_only_summary_in_expanded_transcript() {
let cell = new_reasoning_summary_block(
vec!["**Confirming backend JSONL source**".to_string()],
&test_cwd(),
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
insta::assert_snapshot!(
rendered_display.join("\n"),
@"• Confirming backend JSONL source"
);
assert_eq!(rendered_display, Vec::<String>::new());
let rendered_transcript = render_transcript(cell.as_ref());
assert_eq!(
@@ -2803,7 +2800,7 @@ fn reasoning_summary_block_splits_header_and_summary_when_present() {
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
assert_eq!(rendered_display, vec!["• We should fix the bug next."]);
assert_eq!(rendered_display, Vec::<String>::new());
let rendered_transcript = render_transcript(cell.as_ref());
assert_eq!(rendered_transcript, vec!["• We should fix the bug next."]);
@@ -2820,7 +2817,7 @@ fn reasoning_summary_block_hides_empty_html_comment_parts() {
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
insta::assert_snapshot!(rendered_display.join("\n"), @"");
assert_eq!(rendered_display, Vec::<String>::new());
let rendered_transcript = render_transcript(cell.as_ref());
assert_eq!(rendered_transcript, Vec::<String>::new());
@@ -2838,7 +2835,7 @@ fn reasoning_summary_block_preserves_bold_content_after_empty_html_comment_part(
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
insta::assert_snapshot!(rendered_display.join("\n"), @"• Important conclusion");
assert_eq!(rendered_display, Vec::<String>::new());
let rendered_transcript = render_transcript(cell.as_ref());
assert_eq!(rendered_transcript, vec!["• Important conclusion"]);
@@ -2866,7 +2863,7 @@ fn reasoning_summary_block_strips_header_after_leading_empty_part() {
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
insta::assert_snapshot!(rendered_display.join("\n"), @"• Tests passed");
assert_eq!(rendered_display, Vec::<String>::new());
let rendered_transcript = render_transcript(cell.as_ref());
assert_eq!(rendered_transcript, vec!["• Tests passed"]);
@@ -2883,7 +2880,7 @@ fn reasoning_summary_block_drops_empty_part_after_real_content() {
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
insta::assert_snapshot!(rendered_display.join("\n"), @"• done");
assert_eq!(rendered_display, Vec::<String>::new());
let rendered_transcript = render_transcript(cell.as_ref());
assert_eq!(rendered_transcript, vec!["• done"]);
@@ -2897,7 +2894,7 @@ fn reasoning_summary_block_preserves_literal_html_comment() {
);
let rendered_display = render_lines(&cell.display_lines(/*width*/ 80));
insta::assert_snapshot!(rendered_display.join("\n"), @"• Use <!-- --> in JSX.");
assert_eq!(rendered_display, Vec::<String>::new());
let rendered_transcript = render_transcript(cell.as_ref());
assert_eq!(rendered_transcript, vec!["• Use <!-- --> in JSX."]);