You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Agent app: parallel tool calls leave permanently spinning, empty tool entries in the thought panel #43823
Hi @xpSongJJ! I'm Dosu and I'm helping the Dify team.
This looks like a frontend merge bug. I haven't reproduced it, but the code explains the 2N entries.
The backend creates one thought row per tool call. When a tool result arrives, it looks the row up by tool_call_id, updates that row's observation, and re-publishes the same thought id, so the result targets the correct row (_AgentProcessRecorder).
The chat hook, however, only merges an incoming thought into the last entry in agent_thoughts. If the id doesn't match the last entry, it pushes the thought as a new entry (onThought in hooks.ts). The send-message handler later in the same file uses the same logic [1].
With two parallel calls, the list is [A(call), B(call)]. When A's result arrives, A's id isn't the last entry's id, so the update is appended as a third entry. The original A row never gets its observation, so it keeps spinning with empty output. When the message ends the spinner stops, but the duplicate remains.
A likely fix is to find the existing thought by id anywhere in agent_thoughts (findIndex). If found, merge it in place with mergeStreamingThought; otherwise push a new entry. Both onThought handlers in web/app/components/base/chat/chat/hooks.ts need this change.
I didn't find an existing report or prior fix for this, so it needs maintainer confirmation.
Activity
dosubot commentedon Oct 10, 2026
Hi @xpSongJJ! I'm Dosu and I'm helping the Dify team.
This looks like a frontend merge bug. I haven't reproduced it, but the code explains the 2N entries.
The backend creates one thought row per tool call. When a tool result arrives, it looks the row up by
tool_call_id, updates that row's observation, and re-publishes the same thought id, so the result targets the correct row (_AgentProcessRecorder).The chat hook, however, only merges an incoming thought into the last entry in
agent_thoughts. If the id doesn't match the last entry, it pushes the thought as a new entry (onThoughtin hooks.ts). The send-message handler later in the same file uses the same logic [1].With two parallel calls, the list is
[A(call), B(call)]. When A's result arrives, A's id isn't the last entry's id, so the update is appended as a third entry. The original A row never gets its observation, so it keeps spinning with empty output. When the message ends the spinner stops, but the duplicate remains.A likely fix is to find the existing thought by
idanywhere inagent_thoughts(findIndex). If found, merge it in place withmergeStreamingThought; otherwise push a new entry. BothonThoughthandlers inweb/app/components/base/chat/chat/hooks.tsneed this change.I didn't find an existing report or prior fix for this, so it needs maintainer confirmation.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
Stream29 commentedon Oct 12, 2026
On
ed7592fe21, interleaved A/B thought updates leave duplicate empty cards in a frontend test. The same test passes with #43843.Component fixture — synthetic SSE:
Main:

With #43843:

harsh373 commentedon Oct 15, 2026
hey can i fix this issue?