Loss of Chat message response on chat switch mid response #3040

Closed
opened 2026-02-21 17:53:06 -05:00 by yindo · 0 comments
Owner

Originally created by @bekhruz-ti on GitHub (May 8, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a quesion, 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 (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.6.6

Cloud or Self Hosted

Cloud and Self Hosted (Docker)

Steps to reproduce

  1. Start a conversation with an agent through the chat interface.
  2. While the agent is formulating a response, switch to a different chat with the same agent. (In the screenshot below, I switched from chat Greeting to Greeting myself and back)
  3. Return to the original chat.

image

This issue can be reproduced both in the Cloud and Self Hosted Docker versions of Dify.

✔️ Expected Behavior

When switching chats, the agent's entire response should be saved. This means that not only the part of the response generated before the chat switch, but also the full, completed response should be visible when returning to the original chat.

Ideally, the expected behavior is similar to the current behavior with starting different chats with the same agent on different browser tabs. In such a case, you can see the message being generated in real time as you switch between tabs, and the final version is properly saved.

Actual Behavior

  • In the case when user switches the chat while the agent was responding, the agent's response is not saved and is not visible when returning to the original chat. In fact on return user does not even see the message they initially wrote to trigger the agent, that message only becomes available on page reload (ctrl + R) however the agent message bubble remains empty.

image

As a side note,

  • If the ChatStopAPI functionality is disabled, the cutoff response will appear but only after a page reload. ChatStopAPI is prematurely terminating the message generation process when a chat context switch occurs. Based on the behavior chat messages are being saved only on the agent_though event received from the backend which is cutoff on context switch due to ChatStopAPI call.
  • This limitation where ChatStopAPI cuts off chat completion response before agent_thought event is recieved also means if you hit Stop Responding Icon on the UI, the half-generated message will not be saved in DB and disappear on reload. See image below:

image

Originally created by @bekhruz-ti on GitHub (May 8, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a quesion, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Pleas do not modify this template :) and fill in all the required fields. ### Dify version 0.6.6 ### Cloud or Self Hosted Cloud and Self Hosted (Docker) ### Steps to reproduce 1. Start a conversation with an agent through the chat interface. 2. While the agent is formulating a response, switch to a different chat with the same agent. (In the screenshot below, I switched from chat `Greeting` to `Greeting myself` and back) 3. Return to the original chat. ![image](https://github.com/langgenius/dify/assets/123568141/287ed100-2fac-4dc2-af9f-803fa67bddbb) This issue can be reproduced both in the Cloud and Self Hosted Docker versions of Dify. ### ✔️ Expected Behavior When switching chats, the agent's entire response should be saved. This means that not only the part of the response generated before the chat switch, but also the full, completed response should be visible when returning to the original chat. Ideally, the expected behavior is similar to the current behavior with starting different chats with the same agent **on different browser tabs**. In such a case, you can see the message being generated in real time as you switch between tabs, and the final version is properly saved. ### ❌ Actual Behavior - In the case when user switches the chat while the agent was responding, the agent's response is not saved and is not visible when returning to the original chat. In fact on return user does not even see the message they initially wrote to trigger the agent, that message only becomes available on page reload (ctrl + R) however the agent message bubble remains empty. ![image](https://github.com/langgenius/dify/assets/123568141/287ed100-2fac-4dc2-af9f-803fa67bddbb) As a side note, - If the ChatStopAPI functionality is disabled, the cutoff response will appear but only after a page reload. ChatStopAPI is prematurely terminating the message generation process when a chat context switch occurs. Based on the behavior chat messages are being saved only on the `agent_though` event received from the backend which is cutoff on context switch due to ChatStopAPI call. - This limitation where ChatStopAPI cuts off chat completion response before `agent_thought` event is recieved also means if you hit Stop Responding Icon on the UI, the half-generated message will not be saved in DB and disappear on reload. See image below: - ![image](https://github.com/langgenius/dify/assets/123568141/f32a8973-3cf5-4321-a30c-95ca6b241fe8)
yindo added the 🐞 bug label 2026-02-21 17:53:06 -05:00
yindo closed this issue 2026-02-21 17:53:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#3040