Repository navigation
[Fix] comfyui: Fix server-mode bugs in the SGLDiffusion plugin - #44082
Open
OnePunchMonk wants to merge 20 commits into
Open
OnePunchMonk wants to merge 20 commits into
OnePunchMonk wants to merge 20 commits into
Conversation
…t requests Both image endpoints hardcoded timeout=300, with no way to raise it. A large image job, or a first request that triggers torch.compile/warmup on the server, can need more than 300s and the client would time out with no recourse. Add a configurable image_timeout constructor param to SGLDiffusionServerAPI (default 300, unchanged) and expose it as an optional input on SGLDiffusionServerModel.
…he first image get_image_path (used by the image, video, and H3 nodes) saved only image[0] from a batched IMAGE input, silently dropping the rest of the batch with no warning. Raise a clear ValueError when a batch of more than one image is passed, instead of silently keeping just the first.
SGLDiffusionServerAPI.set_lora and the SGLDiffusionServerSetLora node had no strength parameter, even though the server's /set_lora endpoint accepts one (default 1.0). There was no way to dial down a LoRA's effect through this node. Thread strength through the client and expose it as a node input.
…and wrong reported dimensions SGLDVideoInput.get_components returned [video_path] instead of a VideoComponents, so any downstream node reading frames/audio from it would crash; save_to silently dropped format/codec/metadata. Separately, the generic video node always reported the *requested* width/height even when the server resolved a different size (e.g. to match an image-to-video input's aspect ratio). Prefer ComfyUI's own file-backed VideoFromFile, which probes the real file and is immune to both problems; keep SGLDVideoInput only as a fallback that now fails loudly instead of silently doing the wrong thing. Read the generic video node's reported size from the server's response.
…te server can't read
The generic video node sent local temp-file paths as input_reference and
a client-side temp directory as output_path; the H3 node built file://
URIs for keyframes/references. None of that is readable by an SGLD server
on another machine (the image node already avoided this by uploading the
file).
Upload a local input_reference via multipart instead of sending its path.
Never send output_path to the server; let it pick its own location and
download the result through GET /videos/{id}/content when the server's
own file_path isn't locally readable. For H3, embed image conditions
inline as base64 data: URIs (the server's material loader already
supports these) and only build a file:// URI for video/audio references
when the SGLD server is confirmed local, raising a clear error otherwise
instead of silently building a URI that will fail remotely.
…video jobs generate_video takes progress_callback and check_interrupt; both video nodes wire them to comfy.utils.ProgressBar and throw_exception_if_processing_interrupted, and let the interrupt through instead of wrapping it in RuntimeError. Polling sleeps in 1s slices so Cancel is prompt. The server job itself is not aborted (video_api has no abort yet).
OnePunchMonk
requested review from
AgainstEntropy,
BBuf,
HaiShaw,
kevin-mii,
mickqian,
niehen6174,
ping1jing2 and
yichiche
as code owners
October 13, 2026 15:10
This was referenced Oct 13, 2026
# Conflicts: # python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/nodes.py # python/sglang/multimodal_gen/apps/ComfyUI_SGLDiffusion/utils.py
OnePunchMonk
added a commit
to OnePunchMonk/sglang
that referenced
this pull request
Oct 14, 2026
…yui-sgld-nodes Resolve the overlap in server_api.py and nodes.py: keep the multipart upload of a local input_reference and the no-output_path request from sgl-project#44082, and carry enhance_prompt, video_path, request logging, LoRA stacking and merge_mode from this branch onto it. Tests: stub comfy.utils/model_management in the harness, give the fake completed jobs a local file_path, and unpack the video node's new revised_prompt output.
…sending its path generate_video takes video_path for video-to-video. A local file is now sent as the multipart video_reference the server already accepts, so a server on another machine can read it; URLs and server-side paths are still sent as video_path.
…ng /content
A completed job uploaded to cloud storage has a url and no file_path, and
/videos/{id}/content answers 400 for it. The 400 was caught as a poll
error, but the status poll had just reset the error counter, so the node
kept polling until max_wait_time. Return such a job as is so the node
fetches the url, and localize the result outside the poll loop so a real
download error fails at once.
OnePunchMonk
added a commit
to OnePunchMonk/sglang
that referenced
this pull request
Oct 21, 2026
Rebuilds the branch on the current sgl-project#44082 head and keeps only the VIDEO input on the generic video node and the enhance_prompt toggle with a revised_prompt output on the image and video nodes. Drops the checkpoint sweep, the audio-video node (ComfyUI's Get Video Components already returns AUDIO from the VIDEO output), the LoRA list and stack nodes, and the separate test files; the tests now live in test_sgld_server_mode.py.
5 tasks done
This branch has not been deployed
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.
Fixes #44083. Split out of #43536 per review: these are the server-mode fixes, which were moved here as lower priority.
Summary
Fixes for the SGLDiffusion ComfyUI plugin when it talks to an SGLD server. One commit per fix. Bug numbers below match the list in the issue.
input_referenceand a client-sideoutput_path; the H3 node builtfile://URIs for keyframes and references. Local references are now uploaded via multipart (a local video-to-video source goes up asvideo_reference),output_pathis no longer sent (the result is downloaded if the server's path isn't local), H3 image conditions are embedded as base64data:URIs, and local video/audio references against a confirmed-remote server raise a clear error.SGLDVideoInputdidn't implement ComfyUI'sVideoInputcontract.get_components()returned a bare list andsave_todroppedformat/codec/metadata. The node now prefers ComfyUI's file-backedVideoFromFile, and the fallback fails loudly.sizefield. (Same commit as bug 2.)image_timeout(default unchanged)./set_loraacceptsstrength; it's now threaded through the client and node.generate_videotakesprogress_callback/check_interrupt, wired tocomfy.utils.ProgressBarandthrow_exception_if_processing_interrupted. Limits: the server reports progress only as 0 then 100, and Cancel stops the client waiting but the server job keeps running (no abort endpoint yet).Tests
test/test_sgld_server_mode.py(new): 19 tests covering the fixes above, using stubbedcomfy/folder_pathsmodules (no ComfyUI install or GPU).test/test_h3_request.pyupdated for the bug 1/6/7 behavior changes (base64 image URIs instead offile://, real temp files since the client now validatesfile_pathlocally); existing assertions kept. 30/30 pass on CPU.Note: until #43536 lands, these tests need the sglang runtime importable, since the import guard that lets the plugin load without it is in that PR.
CI States
Latest PR Test (Base): ❌ Run #40627090702
Latest PR Test (Extra): ❌ Run #40627090727
Latest PR Test (AMD ROCm 10): ❌ Run #40627090636