Repository navigation
fix(php-sdk): avoid buffering streaming responses - #44271
Merged
Merged
Conversation
This was referenced Oct 22, 2026
crazywoola
approved these changes
Oct 30, 2026
1 task done
This was referenced Nov 26, 2026
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.
Summary
Fixes #44270.
The PHP SDK requests server streaming but buffers the complete response in two methods:
WorkflowClient::run(..., 'streaming', ...)andDifyClient::text_to_audio(..., true). Both omit the final streaming argument tosend_request, leaving Guzzle'sstreamoption false.Forward the existing streaming setting in both calls, matching the PHP chat and completion clients. Preserve public signatures, routes, JSON payloads, and buffered/default behavior. Add one standalone request regression script for both methods and document incremental SSE/audio consumption. For TTS this controls client buffering; whether the provider generates audio incrementally is a separate server behavior.
These two missing argument forwards share the same cause and are covered together in this PR.
Validation
b00c3867, while the existing workflow checks passed. After the combined fix, both methods pass streaming/buffered option, endpoint, payload, Authorization, and response assertions through the real SDK/Guzzle preparation with only transport replaced.RIFFbytes before the delayed tail. These use real HTTP and Guzzle rather than the request test's mock transport.php -l dify-client.phpandphp -l tests/streaming_test.php: no syntax errors;git diff --cached --check: clean.From
sdks/php-client:Screenshots
Not applicable (PHP SDK).
Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint godsAI assistance: Codex investigated, implemented, and ran the checks reported here; no independent human review is claimed.
From Codex