Answer node displays content from all variables instead of only configured output variables #16287

Closed
opened 2026-02-21 19:25:28 -05:00 by yindo · 3 comments
Owner

Originally created by @boy15174 on GitHub (Aug 20, 2025).

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

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a workflow with a tool that outputs multiple streaming variables (e.g., stream and
    custom_stream)
  2. Configure an Answer node to only output one specific variable (e.g., custom_stream)
  3. Run the workflow and observe the Answer node's OUTPUT window shows only the configured variable
    content
  4. Check the frontend UI display in the chat interface

✔️ Expected Behavior

The Answer node should only display content from the variables explicitly configured in its output
template. If configured to only output custom_stream, it should only show content from that variable,
not from other variables like stream.

Actual Behavior

Image

The Answer node displays content from ALL streaming variables, regardless of its configuration. Even
when configured to only output custom_stream (which contains only thinking processes), the frontend UI
shows the complete content from the stream variable (which contains the full analysis report).

The Answer node's OUTPUT window correctly shows only the configured variable content, but the frontend
chat interface displays mixed content from multiple variables, creating inconsistent behavior between
the node's actual output and what users see.

This suggests a bug in the frontend rendering logic where streaming content from unselected variables is
incorrectly included in the final answer display.

Originally created by @boy15174 on GitHub (Aug 20, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, 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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.7.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Create a workflow with a tool that outputs multiple streaming variables (e.g., stream and custom_stream) 2. Configure an Answer node to only output one specific variable (e.g., custom_stream) 3. Run the workflow and observe the Answer node's OUTPUT window shows only the configured variable content 4. Check the frontend UI display in the chat interface ### ✔️ Expected Behavior The Answer node should only display content from the variables explicitly configured in its output template. If configured to only output custom_stream, it should only show content from that variable, not from other variables like stream. ### ❌ Actual Behavior <img width="1872" height="1316" alt="Image" src="https://github.com/user-attachments/assets/83a2b735-9f03-4c38-bb3b-5588fcd6c3e1" /> The Answer node displays content from ALL streaming variables, regardless of its configuration. Even when configured to only output custom_stream (which contains only thinking processes), the frontend UI shows the complete content from the stream variable (which contains the full analysis report). The Answer node's OUTPUT window correctly shows only the configured variable content, but the frontend chat interface displays mixed content from multiple variables, creating inconsistent behavior between the node's actual output and what users see. This suggests a bug in the frontend rendering logic where streaming content from unselected variables is incorrectly included in the final answer display.
yindo added the 🐞 bugwont-fix labels 2026-02-21 19:25:28 -05:00
yindo closed this issue 2026-02-21 19:25:28 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 20, 2025):

Hi @boy15174! I'm Dosu and I’m helping the dify team.

You're correct—this is a frontend bug. The backend correctly restricts the Answer node output to only the variables configured in its template, but the frontend chat interface currently concatenates all streaming content from every variable, regardless of configuration. This happens because the frontend does not filter streaming chunks by the intended output variable(s) when rendering the answer in the chat UI. The backend streaming protocol includes a from_variable_selector field in its responses, which can be used to tag and filter content by variable [source].

To fix this, update the frontend chat rendering logic (specifically in the streaming handler and Answer component) to only display content where from_variable_selector matches the variable(s) configured in the Answer node. This will ensure consistency between the node output window and the chat UI display [source].

Recent PRs have touched variable filtering logic in workflow node components, but none directly address this bug yet [source]. This change should be feasible and maintainable given the modular separation between backend and frontend logic.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Aug 20, 2025): <!-- Greeting --> Hi @boy15174! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> You're correct—this is a frontend bug. The backend correctly restricts the Answer node output to only the variables configured in its template, but the frontend chat interface currently concatenates all streaming content from every variable, regardless of configuration. This happens because the frontend does not filter streaming chunks by the intended output variable(s) when rendering the answer in the chat UI. The backend streaming protocol includes a `from_variable_selector` field in its responses, which can be used to tag and filter content by variable [[source]](https://github.com/langgenius/dify/blob/cfefe4f738301701535ba1fa58da0f0f3f0273c7/api/core/app/entities/task_entities.py). To fix this, update the frontend chat rendering logic (specifically in the streaming handler and Answer component) to only display content where `from_variable_selector` matches the variable(s) configured in the Answer node. This will ensure consistency between the node output window and the chat UI display [[source]](https://github.com/langgenius/dify/blob/cfefe4f738301701535ba1fa58da0f0f3f0273c7/web/app/components/base/chat/chat/hooks.ts). Recent PRs have touched variable filtering logic in workflow node components, but none directly address this bug yet [[source]](https://github.com/langgenius/dify/pull/23002). This change should be feasible and maintainable given the modular separation between backend and frontend logic. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/f2d04a4e-d1d1-46ad-b1c5-84d3dc6cf6ff?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f2d04a4e-d1d1-46ad-b1c5-84d3dc6cf6ff?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f2d04a4e-d1d1-46ad-b1c5-84d3dc6cf6ff?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f2d04a4e-d1d1-46ad-b1c5-84d3dc6cf6ff?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f2d04a4e-d1d1-46ad-b1c5-84d3dc6cf6ff?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f2d04a4e-d1d1-46ad-b1c5-84d3dc6cf6ff?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f2d04a4e-d1d1-46ad-b1c5-84d3dc6cf6ff?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/24212)
Author
Owner

@crazywoola commented on GitHub (Aug 20, 2025):

This is not related to dify itself, please submit an issue to the author's repo instead.

@crazywoola commented on GitHub (Aug 20, 2025): This is not related to dify itself, please submit an issue to the author's repo instead.
Author
Owner

@boy15174 commented on GitHub (Aug 20, 2025):

@crazywoola
I am the author of this plugin. I found a bug in dify when I was making the plugin. Please read the issues I raised.

Root Cause Location:
The bug is in api/core/app/apps/advanced_chat/generate_task_pipeline.py at line 437:
self._task_state.answer += delta_text

This line accumulates ALL streaming text chunks into the final answer, regardless of which variable they
come from or what the Answer node is configured to display.

Problematic Code Flow:

  1. In _handle_text_chunk_event method (lines 430-440):
    def _handle_text_chunk_event(self, event: QueueTextChunkEvent) -> TextChunkStreamResponse:
    delta_text = event.text
    if delta_text is None:
    return TextChunkStreamResponse(data=TextChunk(text=""))

    if self._task_state.answer:
    self._task_state.answer += delta_text # <-- Bug: Accumulates all chunks
    else:
    self._task_state.answer = delta_text
    ... rest of the method

  2. The from_variable_selector field in QueueTextChunkEvent is ignored during accumulation

  3. Answer node configuration is not checked before adding chunks to self._task_state.answer

@boy15174 commented on GitHub (Aug 20, 2025): @crazywoola I am the author of this plugin. I found a bug in dify when I was making the plugin. Please read the issues I raised. Root Cause Location: The bug is in api/core/app/apps/advanced_chat/generate_task_pipeline.py at line 437: self._task_state.answer += delta_text This line accumulates ALL streaming text chunks into the final answer, regardless of which variable they come from or what the Answer node is configured to display. Problematic Code Flow: 1. In _handle_text_chunk_event method (lines 430-440): def _handle_text_chunk_event(self, event: QueueTextChunkEvent) -> TextChunkStreamResponse: delta_text = event.text if delta_text is None: return TextChunkStreamResponse(data=TextChunk(text="")) if self._task_state.answer: self._task_state.answer += delta_text # <-- Bug: Accumulates all chunks else: self._task_state.answer = delta_text ... rest of the method 2. The from_variable_selector field in QueueTextChunkEvent is ignored during accumulation 3. Answer node configuration is not checked before adding chunks to self._task_state.answer
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#16287