Skip to content

Agent app: parallel tool calls leave permanently spinning, empty tool entries in the thought panel #43823

Closed

Description

@xpSongJJ

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

Dify 1.17.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create an Agent app with at least two independently callable query tools.
  2. Send a message that makes the model call two tools in parallel in the same round (any model that emits parallel tool calls).
  3. While the answer is still streaming, open the thought panel ("思考过程").

✔️ Expected Behavior

Each tool entry completes with its own observation once the tool returns.

❌ Actual Behavior

With N parallel tool calls, the panel ends up with about 2N entries during streaming:

  • The earlier parallel tool entries keep showing the loading spinner for the rest of the run, and their expanded result is empty.
  • The actual results appear as additional, duplicated entries appended after them.
  • When the message finishes, the spinners stop, but the empty duplicate entries remain.

Activity

  1. added
    🐞 bug
    on Oct 10, 2026
  2. added
    review: low
    on Oct 10, 2026
  3. dosubot commented on Oct 10, 2026

    @dosubot

    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.

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about dify

  4. Stream29 commented on Oct 12, 2026

    @Stream29
    Contributor

    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:
    Main thought component

    With #43843:
    Candidate thought component

  5. harsh373 commented on Oct 15, 2026

    @harsh373

    hey can i fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    review: low🐞 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions