Compact successful command activity in the TUI (#38921)

## What changed

- Group consecutive successful agent and unified-exec startup commands into a compact `Ran N commands` entry while preserving their full transcript.
- Flush command groups at interaction boundaries, after failures, and after 32 completed commands. Keep manual shell commands and failed or declined commands visible.
- Apply the same grouping rules when replaying thread history without duplicating command starts or disturbing unrelated active commands.

## Testing

- Add TUI coverage for live and replayed grouping, transcript preservation, failures, overlapping commands, group limits, and interaction boundaries.

GitOrigin-RevId: d6602a20201644012fcff3d6cecf4690024383a9
This commit is contained in:
Eric Traut authored and copyberry committed 2026-08-17 00:32:09 +00:00
1 parent 935b1c4e3d
commit 1f41cc5d92
18 files changed
+696 -76

No files matched your search

@@ -266,6 +266,7 @@ impl ChatWidget {
pub(crate) fn handle_exec_approval_now(&mut self, ev: ExecApprovalRequestEvent) {
self.flush_answer_stream_with_separator();
self.flush_completed_command_activity();
let command = shlex::try_join(ev.command.iter().map(String::as_str))
.unwrap_or_else(|_| ev.command.join(" "));
self.notify(Notification::ExecApprovalRequested { command });
@@ -293,6 +294,7 @@ impl ChatWidget {
pub(crate) fn handle_apply_patch_approval_now(&mut self, ev: ApplyPatchApprovalRequestEvent) {
self.flush_answer_stream_with_separator();
self.flush_completed_command_activity();
let changed_paths = ev.changes.keys().cloned().collect();
let request = ApprovalRequest::ApplyPatch(ApplyPatchApprovalRequest {
@@ -322,6 +324,7 @@ impl ChatWidget {
params: McpServerElicitationRequestParams,
) {
self.flush_answer_stream_with_separator();
self.flush_completed_command_activity();
self.notify(Notification::ElicitationRequested {
server_name: params.server_name.clone(),
@@ -377,6 +380,7 @@ impl ChatWidget {
}
pub(crate) fn push_approval_request(&mut self, request: ApprovalRequest) {
self.flush_completed_command_activity();
self.bottom_pane
.push_approval_request(request, &self.config.features);
self.set_ambient_pet_notification(
@@ -390,6 +394,7 @@ impl ChatWidget {
&mut self,
request: McpServerElicitationFormRequest,
) {
self.flush_completed_command_activity();
self.bottom_pane
.push_mcp_server_elicitation_request(request);
self.set_ambient_pet_notification(
@@ -401,6 +406,7 @@ impl ChatWidget {
pub(crate) fn handle_request_user_input_now(&mut self, ev: ToolRequestUserInputParams) {
self.flush_answer_stream_with_separator();
self.flush_completed_command_activity();
let question_count = ev.questions.len();
let summary = Notification::user_input_request_summary(&ev.questions);
let title = match (question_count, summary.as_deref()) {
@@ -419,6 +425,7 @@ impl ChatWidget {
pub(crate) fn handle_request_permissions_now(&mut self, ev: RequestPermissionsEvent) {
self.flush_answer_stream_with_separator();
self.flush_completed_command_activity();
let request = ApprovalRequest::Permissions(PermissionsApprovalRequest {
thread_id: self.thread_id.unwrap_or_default(),
thread_label: None,