fix(tui): Fix duplicate tool execution messages in ACP#88
Merged
CSRessel merged 4 commits intoDec 9, 2025
Merged
Conversation
When agent text streams during an ACP tool call execution, the incomplete ExecCell was being flushed to history. When the tool call completed, a new ExecCell was created, resulting in duplicate entries showing both "Running" and "Ran" states for the same command. This fix tracks incomplete ExecCells that get flushed during streaming in a pending map keyed by call_id. When ExecCommandEnd arrives, the pending cell is retrieved and completed instead of creating a new one. Changes: - Add `pending_exec_cells` field to ChatWidget to track incomplete cells - Modify `flush_active_cell` to save incomplete ExecCells to pending map - Modify `handle_exec_end_now` to check pending map before creating new - Add `pending_call_ids` method to ExecCell for tracking - Add cleanup of pending cells in `on_task_complete` - Add E2E test with interleaved text/tool call events to verify fix
Move the pending_exec_cells HashMap from ChatWidget into a dedicated PendingExecCellTracker struct in its own module. This encapsulates the pending cell tracking logic with typed methods (save_pending, retrieve, drain_failed), making the code more maintainable and resilient to upstream TUI changes. 🤖 Generated with [Nori](https://nori.ai) Co-Authored-By: Nori <contact@tilework.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When agent text streams during an ACP tool call execution, the incomplete ExecCell was being flushed to history. When the tool call completed, a new ExecCell was created, resulting in duplicate entries showing both "Running" and "Ran" states for the same command.
This fix tracks incomplete ExecCells that get flushed during streaming in a pending map keyed by call_id. When ExecCommandEnd arrives, the pending cell is retrieved and completed instead of creating a new one.
Changes:
pending_exec_cellsfield to ChatWidget to track incomplete cellsflush_active_cellto save incomplete ExecCells to pending maphandle_exec_end_nowto check pending map before creating newpending_call_idsmethod to ExecCell for trackingon_task_complete