-
Notifications
You must be signed in to change notification settings - Fork 2
tui: shell tool output content duplicated within single entry after #2116 fix #2126
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
After the fix for #2116 (which correctly eliminated the duplicate tool entry), a new issue remains: the content within a single tool entry is duplicated — the command and output appear twice inside one entry.
Root Cause
Two code paths contribute content to the same streaming message:
Path A — ToolStart (app.rs handle_tool_start_event):
- Creates a new streaming message with initial content:
"$ {command}\n"
Path B — OutputChunk (app.rs handle_tool_output_chunk):
- Appends raw output chunks as they stream in
Path C — ToolOutput (app.rs handle_tool_output_event line 570):
- Receives
body_displayfromTuiChannel::send_tool_outputwhich contains"$ {cmd}\n{output}"(the full formatted result) - Calls
content.push_str(&output)— appends the full formatted string onto the streaming message that already has"$ {cmd}\n"+ raw chunks
Result: The streaming message ends up with:
$ echo 'hello'
hello ← from OutputChunks (Path B)
$ echo 'hello'
hello ← from body_display append (Path C)
Steps to Reproduce
- Run with TUI:
cargo run --features full -- --tui --config .local/config/testing.toml - Send:
Run the shell command: echo 'test' - Observe the tool result entry in the chat panel — command+output appears twice within one entry
Expected Behavior
Command and output appear exactly once per tool call.
Affected Code
crates/zeph-tui/src/app.rs—handle_tool_output_event(thecontent.push_str(&output)call)crates/zeph-tui/src/channel.rs—TuiChannel::send_tool_output(sends body_display with full cmd+output)
Fix Options
- In
handle_tool_output_event: skippush_strwhen streaming chunks have already been accumulated (check if streaming message has chunks > 0) - In
TuiChannel::send_tool_output: send only the final output without the command prefix (command is already in the streaming message from ToolStart) - Replace the streaming message entirely with the body_display on ToolOutput (discard incremental chunks)
Severity
MEDIUM — cosmetic but confusing: tool results appear doubled in TUI
Discovered
CI-79 (2026-03-22), post-fix verification of #2116.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working