Keep TUI tool calls grouped across hidden reasoning (#64193)

## Why

A hidden reasoning summary between commands can split them into separate
tool groups even though the transcript shows nothing between them.

## What changed

Skip transcript-only reasoning summaries when grouping tool calls.

## Testing

Add a snapshot test that checks a completed `just lint` and a running
`just test` appear in one two-call group across a hidden reasoning summary.

GitOrigin-RevId: 3829394047981a66ad358ecc32addfc213e5f927
This commit is contained in:
Felipe Coury
2026-11-26 18:05:21 +00:00
committed by copyberry
parent 1f9549e265
commit f229915597
2 changed files with 30 additions and 3 deletions
@@ -199,6 +199,9 @@ impl TurnDetails {
let mut hidden_count = 0;
let mut searches = std::collections::HashSet::new();
for (index, cell) in cells.iter().enumerate().rev() {
if crate::thread_transcript::is_hidden_activity_detail(cell) {
continue;
}
// Keep older calls outside the group whose disclosure is pinned on screen.
if group.anchor.is_some_and(|anchor| {
snapshot
@@ -241,9 +244,7 @@ impl TurnDetails {
&& (!calls.is_empty()
|| markdown.is_some()
|| any.is::<AgentMessageCell>()
|| any
.downcast_ref::<ReasoningSummaryCell>()
.is_some_and(|reasoning| !reasoning.is_transcript_only()))
|| any.is::<ReasoningSummaryCell>())
{
rows[index].parent = Some(start);
hidden_count += calls.len().max(1);
+26
View File
@@ -1474,6 +1474,32 @@ fn collapsing_tool_group_refills_viewport() {
insta::assert_snapshot!(collapsed);
}
#[test]
fn hidden_reasoning_keeps_the_next_command_in_the_same_tool_group() {
let [mut first, next] = ["lint", "test"].map(|id| {
crate::exec_cell::new_active_exec_command(
id.into(),
vec!["just".into(), id.into()],
Vec::new(),
codex_app_server_protocol::CommandExecutionSource::Agent,
/*interaction_input*/ None,
/*animations_enabled*/ false,
)
});
first.complete_call(
"lint",
crate::exec_cell::CommandOutput::new(/*exit_code*/ 0, String::new()),
std::time::Duration::ZERO,
);
let reasoning = crate::history_cell::new_reasoning_summary_block(
vec!["**Checking tests**".into()],
std::path::Path::new("."),
);
let cells: &[Arc<dyn HistoryCell>] = &[Arc::new(first), Arc::new(*reasoning)];
let screen = parked_screen(&mut TranscriptView::default(), cells, Some(&next));
insta::assert_snapshot!(screen, @" ▸ 2 tool calls · Running just test");
}
#[test]
fn late_command_completion_keeps_tool_groups_independent() {
use codex_app_server_protocol::CommandExecutionSource;