Skip to content

fix: deduplicate final chunk yield in Dify chatflow streaming#2049

Merged
RockChinQ merged 3 commits intomasterfrom
copilot/investigate-runtime-error
Mar 11, 2026
Merged

fix: deduplicate final chunk yield in Dify chatflow streaming#2049
RockChinQ merged 3 commits intomasterfrom
copilot/investigate-runtime-error

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

  • Investigated the duplicate message bug with Dify backend
  • Fix _chat_messages_chunk in difysvapi.py to prevent duplicate final chunk yields
  • Run existing tests to verify fix (70 passed)
  • Fix ruff formatting to pass CI lint check
  • Code review - no issues found
  • CodeQL security scan - no alerts
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]:</issue_title>
<issue_description>### Runtime environment

版本v4.9.0,部署方式: uvx langbot@latest

Exception

Image

在流水线对话测试的时候,dify后台返回一条数据,但是longbot返回两条数据。

Reproduction steps

No response

Enabled plugins

No response</issue_description>

<agent_instructions>investigate this issue</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…w_finished and message_end events

Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate bug causing multiple responses from longbot fix: deduplicate final chunk yield in Dify chatflow streaming Mar 11, 2026
@RockChinQ RockChinQ marked this pull request as ready for review March 11, 2026 06:37
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug? Bug或Bug修复相关 / maybe a bug eh: Improve enhance: 现有功能的改进 / improve current features m: Provider LLM 模型相关 / LLMs management labels Mar 11, 2026
@RockChinQ
Copy link
Member

@copilot fix ci errors

Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 11, 2026

@copilot fix ci errors

Fixed in commit 6d48705. The CI failure was a ruff format check — the condition expression needed to be broken across multiple lines per Ruff's formatting rules.

@RockChinQ RockChinQ merged commit 2655425 into master Mar 11, 2026
@RockChinQ RockChinQ deleted the copilot/investigate-runtime-error branch March 11, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug? Bug或Bug修复相关 / maybe a bug eh: Improve enhance: 现有功能的改进 / improve current features m: Provider LLM 模型相关 / LLMs management size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:

2 participants