mirror of
https://github.com/Comfy-Org/comfy-remote-nodes.git
synced 2026-11-04 23:37:22 +00:00
[PR #10] [MERGED] feat(local-validate): fail-fast on over-cap image batches #10
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-remote-nodes#10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-remote-nodes/pull/10
Author: @Kosinkadink
Created: 5/15/2026
Status: ✅ Merged
Merged: 5/15/2026
Merged by: @Kosinkadink
Base:
main← Head:feat/image-max-batch-rule📝 Commits (1)
37a4961feat(local-validate): fail-fast on over-cap image batches📊 Changes
2 files changed (+384 additions, -0 deletions)
View changed files
➕
notes/run_image_max_batch.py(+268 -0)📝
proxy_node.py(+116 -0)📄 Description
Summary
First slice of Track D (RNP/1 immediate follow-ups), client side. Wires
proxy_node._encode_inputsto consult each input'sdescriptor.input.<section>.<name>[1].local_validate.image_max_batchrule. When set, the encoder assertstensor.shape[0] <= capfor IMAGE inputs and raisesRnpProtocolError(code=INPUT_INVALID, user_facing=True)before any HTTP round trip — so a workflow with N>cap reference frames surfaces the per-provider error in the standard friendly-message dialog instead of paying for a doomed upstream call.Changes
proxy_node.py_collect_local_validate(descriptor)walksdescriptor.input.{required,optional}and returns{name: rules}for every input that carries a non-emptylocal_validateblock. Inputs nested insideAUTOGROW/DYNAMIC_COMBOaren't surfaced — the parser doesn't yet flatten them into top-level inputs, so the cap declared on those templates documents the future contract rather than firing today._enforce_local_validate(name, value, rules, *, node_id)applies each supported rule tovalue. Today onlyimage_max_batchis implemented: rank-4 / rank-3-channels-last tensors withshape[0] > capraiseRnpProtocolErrorwith codeINPUT_INVALIDanduser_facing=True. Friendly per-provider message echoes the upstream wording — Flux2's "The current maximum number of supported images is N" for cap≥2; a "expects a single image frame" copy for cap=1 (LTXV i2v)._encode_inputsruns the validator before the encoder so the raise happens before any tensor → PNG conversion ormaybe_externalizeupload — the cheapest possible fail point.local_validate→ no-op, missingimage_max_batchsub-key → no-op, non-tensor input → no-op, non-image rank → no-op. Older descriptors emit no rule and the encoder behaves identically to before.notes/run_image_max_batch.py(new)Standalone smoke test that loads the helper functions via AST extraction (so the test runs in a bare venv with just
torchinstalled; doesn't drag in the ComfyUI package). Asserts:_collect_local_validateextracts the rule from a Flux2-shaped descriptor.cap=2raisesRnpProtocolErrorwithcode=INPUT_INVALID,user_facing=True, and thenode_id+ counts mentioned in the message.cap=2encodes cleanly.cap=1surfaces the single-frame copy (LTXV i2v shape).local_validateis a no-op.local_validateblock missing theimage_max_batchkey is a no-op.Verification
Lockstep
Paired with server PR https://github.com/Comfy-Org/comfy-rnp-server/pull/15 (
feat(descriptor): declare image_max_batch local_validate caps), which adds the matchinglocal_validate.image_max_batchrule to each provider's IMAGE input options dict. The server-side per-call caps inside each provider'sexecute()stay in place as defense-in-depth; non-compliant clients still fail.Both branches were cut off
origin/mainbefore PR-2 lands; the orchestrator will rebase PR-3 onto PR-2 before merging.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.