dify - ✅(Solved) Fix Chatflow API requests cannot be terminated when citation markers are matched. [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#34885Fetched 2026-04-12 13:23:13
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
2
Timeline (top)
commented ×1cross-referenced ×1labeled ×1referenced ×1

Fix Action

Fixed

PR fix notes

PR #34948: fix(web): release responding lock on annotation-reply message_end

Description (problem / solution / changelog)

Fixes #34885. Same root cause as the prematurely-closed #33103.

When a Chatflow message matches an annotation reply, the backend fires a single message_end event with metadata.annotation_reply and closes the stream without going through the normal terminal event that triggers onCompleted. So handleResponding(false), which normally runs inside onCompleted, never fires, and the chat UI stays stuck in "generating" until the SSE connection physically closes.

The file already has a working version of this path. The regenerate-flow onMessageEnd handler around line 881 correctly does handleResponding(false); return in its annotation branch. The initial-send handler around line 359 just wasn't doing the same thing. I restructured it to match: check for annotation_reply at the callback level, apply the annotation via updateChatTreeNode, release the responding lock, return. Non-annotation branch is untouched.

686 tests in app/components/base/chat/chat/ pass, lint and types clean. I don't have an annotation configured on a live Dify to reproduce visually, but since I'm mirroring a sibling function in the same file I'm pretty confident in the shape of the fix.

Changed files

  • web/app/components/base/chat/chat/hooks.ts (modified, +16/-6)
RAW_BUFFERClick to expand / collapse

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.13.3

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Chatflow API requests cannot be terminated when citation markers are matched.

annotations <img width="1520" height="933" alt="Image" src="https://github.com/user-attachments/assets/db988211-591c-4058-94c8-2ff6ff3a1264" />

Issues with annotations,does not terminate <img width="1299" height="1183" alt="Image" src="https://github.com/user-attachments/assets/d0062a7e-0240-4ccf-8038-972e84e1c12c" />

Issues outside the scope of annotations complete as expected. <img width="1299" height="1183" alt="Image" src="https://github.com/user-attachments/assets/ce880f25-f5e7-4a4d-9f66-0d40acf4fa11" />

<img width="1255" height="1139" alt="Image" src="https://github.com/user-attachments/assets/aaa18572-06d9-4b38-9927-9f46d15ccaab" />

✔️ Expected Behavior

Can complete successfully

❌ Actual Behavior

Does not finish as expected

extent analysis

TL;DR

Investigate and adjust the annotation handling in the Chatflow API to properly terminate requests when citation markers are matched.

Guidance

  • Review the annotation processing logic to identify why requests are not being terminated as expected when citation markers are matched.
  • Compare the successful completion of requests outside the scope of annotations to identify potential differences in handling.
  • Verify that the issue is specific to the annotation feature and not a broader problem with the Chatflow API.
  • Check for any existing issues or discussions related to annotation handling in the Dify project.

Notes

The provided information suggests a specific issue with annotation handling, but without more details about the implementation, it's difficult to provide a more targeted solution.

Recommendation

Apply workaround: Adjust the annotation handling logic to ensure proper termination of requests when citation markers are matched, as this seems to be the root cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING