Fix tool call stuck as running when moved out of active reasoning block#2360
Merged
dgageot merged 1 commit intodocker:mainfrom Apr 10, 2026
Merged
Conversation
AddOrUpdateToolCall only checked the active (last) reasoning block for existing tool calls. If a tool call was added to a reasoning block that later became inactive (due to new messages being appended), the lookup missed it and created a duplicate entry. The duplicate stayed stuck at ToolStatusRunning indefinitely while AddToolResult updated the original in the old reasoning block. Scan all reasoning blocks instead of only the active one, matching the approach already used by AddToolResult. Fixes docker#2333 Assisted-By: docker-agent
trungutt
approved these changes
Apr 9, 2026
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.
Problem
When an MCP tool call (e.g.
go_workspacefrom gopls) completed successfully, the TUI kept displaying it as running with an ever-increasing duration and the 60-second warning.Root Cause
AddOrUpdateToolCallonly checked the active (last) reasoning block when looking for an existing tool call to update. If the tool call was added to a reasoning block that later became inactive (because new messages were appended), the lookup missed it and created a duplicate standalone entry stuck atToolStatusRunningforever.Meanwhile,
AddToolResultcorrectly scanned all reasoning blocks and updated the original entry — but the duplicate was never cleaned up.Fix
Changed
AddOrUpdateToolCallto scan all reasoning blocks for existing tool calls, matching the approach already used byAddToolResult.Testing
Added
TestAddOrUpdateToolCallFindsToolInNonActiveReasoningBlockwhich:AddOrUpdateToolCallwith Running statusThe test fails on the old code (3 messages instead of 2) and passes with the fix.
Fixes #2333