Repository navigation
fix(tool): preserve non-streamed variables in response answers - #345
Merged
WH-2099 merged 1 commit intoNov 12, 2026
Merged
Conversation
|
All contributors on this pull request have signed the CLA. |
5 tasks done
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
6 tasks done
Only close custom variable streams that actually emitted chunks so static values remain available to the response filter's variable-pool fallback.
WH-2099
force-pushed
the
fix/non-stream-tool-variable-answer-public
branch
from
November 12, 2026 11:29
b5625e0 to
b10f463
Compare
This was referenced Nov 12, 2026
4 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Reviewed the contribution guidelines and related issues and pull requests.
Related Issue
Fixes langgenius/dify#44141
Summary
A tool can return a non-streaming custom variable such as
session_idthat appears in the final workflow output but disappears from the streamed and saved Chatflow answer.ToolNode emits an empty final stream marker for that variable, causing ResponseStreamFilter to finish the selector before reading its value from the variable pool.
Track custom variables that emitted stream chunks and send final markers only for those variables.
Static variables then use the existing variable-pool fallback.
Preserve standard text finalization, empty streamed values, original output types, and repeated-assignment behavior.
Regression tests exercise the real Start → session Tool → text Tool → Answer chain through Engine and ResponseStreamFilter, checking that the assembled reply matches the final graph output.
They also cover static and streamed session IDs, empty values, and typed repeated assignments.
Validation on the rebased branch:
just checkpassed: lockfile, formatting, lint, types, and architectural imports.The engine tests use an in-memory tool runtime.
Live Dify/plugin-daemon execution and database persistence were not exercised; the Dify adapter and answer-persistence paths were inspected.
Checklist
!