Skip to content

Think block shows "Thought (0.0s)" and collapses while reasoning is still streaming on 1.17.x #45682

Closed

Description

@alterxyz

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

1.17.1 and the current lts/1.17.x branch. main (1.18.0 and later) is not affected.

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Use a model or agent strategy that streams its reasoning inline in the answer text as <think>…</think>.
  2. Send a message in a Chatflow preview (or any chat UI that renders the answer with the shared Markdown component).
  3. Watch the think block while the reasoning is still streaming.

Function-level reproduction on lts/1.17.x:

preprocessThinkTag('<think>\nworking')
// => '<details data-think=true>\nworking\n[ENDTHINKFLAG]</details>'

Browser SSE timestamps from an affected deployment show <think> and </think> arriving about 1.5 s apart, while the UI shows 0.0s.

✔️ Expected Behavior

While </think> has not arrived yet, the block shows "Thinking…", the timer keeps counting, and the reasoning stays expanded as it streams.

❌ Actual Behavior

The block shows "Thought (0.0s)" from the first render and collapses while reasoning is still streaming.

closeUnclosedThinkTags (added in #41764 for #41558) appends </think> to any still-open thought. preprocessThinkTag then rewrites it to [ENDTHINKFLAG], so ThinkBlock marks an in-flight thought as complete and the timer latches at 0.0s.

main already changed preprocessThinkTag in fd2db63 (#44165) to balance the trailing block with </details> instead, which emits no end marker. That change is not on lts/1.17.x.

Activity

  1. added
    🐞 bug
    on Nov 6, 2026
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

    🐞 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions