Skip to content

fix(tui): remove duplicate ToolStart/ToolOutput events in TUI bridge (#2116)#2118

Merged
bug-ops merged 1 commit intomainfrom
fix/2116-tui-tool-call-dup
Mar 22, 2026
Merged

fix(tui): remove duplicate ToolStart/ToolOutput events in TUI bridge (#2116)#2118
bug-ops merged 1 commit intomainfrom
fix/2116-tui-tool-call-dup

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Mar 22, 2026

Summary

Root Cause

Two independent paths wrote to the same agent_event_tx channel:

Path Events
TuiChannel (Channel trait) ToolStart, ToolOutput ← authoritative
forward_tool_events_to_tui ToolStart, ToolOutputChunk, ToolOutputStarted/Completed were duplicates

Changes

  • src/tui_bridge.rs: skip ToolEvent::Started and ToolEvent::Completed in forward_tool_events_to_tui; add regression test forward_tool_events_skips_started_and_completed
  • CHANGELOG.md: entry in [Unreleased] ### Fixed

Test Plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — no new warnings
  • cargo nextest run --workspace --features full --lib --bins6367 passed (+1 regression test)
  • Regression test forward_tool_events_skips_started_and_completed passes: sends Started + OutputChunk + Completed, asserts only 1 ToolOutputChunk event received
  • No data loss: filter_stats/diff/kept_lines are delivered via TuiChannel::send_tool_output in native.rs:1546 — the removed Completed forwarding never used these values

…2116)

forward_tool_events_to_tui forwarded ToolEvent::Started and
ToolEvent::Completed as AgentEvent::ToolStart/ToolOutput, duplicating
events already sent by TuiChannel::send_tool_start/send_tool_output
from the Channel trait. Only ToolEvent::OutputChunk is forwarded now.

Adds regression test forward_tool_events_skips_started_and_completed.
@github-actions github-actions bot added documentation Improvements or additions to documentation bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 22, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 22, 2026 12:53
@bug-ops bug-ops merged commit f9920e4 into main Mar 22, 2026
25 checks passed
@bug-ops bug-ops deleted the fix/2116-tui-tool-call-dup branch March 22, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(tui): tool calls duplicated in TUI mode — ToolStart and ToolOutput sent twice per tool execution

1 participant