[PR #7] [MERGED] feat: input-side image:png_base64_batch envelope #7

Closed
opened 2026-10-26 22:28:51 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-remote-nodes/pull/7
Author: @Kosinkadink
Created: 5/15/2026
Status: ✅ Merged
Merged: 5/15/2026
Merged by: @Kosinkadink

Base: main ← Head: feat/input-batch-envelope


📝 Commits (1)

  • aad9f0b feat(serialization): input-side image:png_base64_batch envelope

📊 Changes

2 files changed (+86 additions, -14 deletions)

View changed files

📝 proxy_node.py (+48 -6)
📝 serialization.py (+38 -8)

📄 Description

Summary

Closes the silent tensor[0] truncation bug for multi-image inputs: when a descriptor advertises "png_base64_batch" for an IMAGE input and the inbound tensor has shape[0] > 1, the encoder now emits a multi-frame envelope (frames=[…]) instead of dropping tensor[1:]. Lockstep with paired server PR — both must merge.

Changes

Client

  • serialization.py: extend encode_image_tensor with an accepts_batch=False keyword. When True AND tensor.shape[0] > 1, emit {"type":"image","encoding":"png_base64_batch","frames":[…],"shape":[B,H,W,C],…} — same wire shape as the existing _decode_image_batch_envelope on the response path so both directions round-trip symmetrically. Default-False keeps the legacy single-frame contract for descriptors that haven't migrated.
  • proxy_node.py: plumb the per-input input_serialization allow-list from descriptor.remote.input_serialization through build_node_class → _execute_remote → _encode_inputs → _encode_one. The wire shape {input_name: <str | list[str]>} normalizes to dict[str, list[str]] once at descriptor parse time. _encode_one passes accepts_batch=("png_base64_batch" in encodings) to the image encoder.
  • IMAGE_PNG_BASE64_BATCH is already in client.CLIENT_CAPABILITIES (was added when the output-side decoder shipped) so no wire-header change.

Verification

  • Both modified files parse cleanly via ast.parse.
  • The output-side _decode_image_batch_envelope already in this file consumes the same frames=[…] shape the new encoder emits — round-trips symmetrically.

Lockstep

Paired server PR (must merge together): https://github.com/Comfy-Org/comfy-rnp-server/pull/12

No back-compat between unmatched server/client versions — the per-provider descriptors that previously narrowed input_serialization to single-string "png_base64" now use ["png_base64", "png_base64_batch"], and the schema_hash changes accordingly.

Amp thread: https://ampcode.com/threads/T-019e29b4-d606-7278-8584-52910661c981


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-remote-nodes/pull/7 **Author:** [@Kosinkadink](https://github.com/Kosinkadink) **Created:** 5/15/2026 **Status:** ✅ Merged **Merged:** 5/15/2026 **Merged by:** [@Kosinkadink](https://github.com/Kosinkadink) **Base:** `main` ← **Head:** `feat/input-batch-envelope` --- ### 📝 Commits (1) - [`aad9f0b`](https://github.com/Comfy-Org/comfy-remote-nodes/commit/aad9f0ba437b80f5f20d6f5d524542cd9cc22a47) feat(serialization): input-side image:png_base64_batch envelope ### 📊 Changes **2 files changed** (+86 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `proxy_node.py` (+48 -6) 📝 `serialization.py` (+38 -8) </details> ### 📄 Description ## Summary Closes the silent `tensor[0]` truncation bug for multi-image inputs: when a descriptor advertises `"png_base64_batch"` for an IMAGE input and the inbound tensor has `shape[0] > 1`, the encoder now emits a multi-frame envelope (`frames=[…]`) instead of dropping `tensor[1:]`. Lockstep with paired server PR — both must merge. ## Changes ### Client - `serialization.py`: extend `encode_image_tensor` with an `accepts_batch=False` keyword. When True AND `tensor.shape[0] > 1`, emit `{"type":"image","encoding":"png_base64_batch","frames":[…],"shape":[B,H,W,C],…}` — same wire shape as the existing `_decode_image_batch_envelope` on the response path so both directions round-trip symmetrically. Default-False keeps the legacy single-frame contract for descriptors that haven't migrated. - `proxy_node.py`: plumb the per-input `input_serialization` allow-list from `descriptor.remote.input_serialization` through `build_node_class` → `_execute_remote` → `_encode_inputs` → `_encode_one`. The wire shape `{input_name: <str | list[str]>}` normalizes to `dict[str, list[str]]` once at descriptor parse time. `_encode_one` passes `accepts_batch=("png_base64_batch" in encodings)` to the image encoder. - `IMAGE_PNG_BASE64_BATCH` is already in `client.CLIENT_CAPABILITIES` (was added when the output-side decoder shipped) so no wire-header change. ## Verification - Both modified files parse cleanly via `ast.parse`. - The output-side `_decode_image_batch_envelope` already in this file consumes the same `frames=[…]` shape the new encoder emits — round-trips symmetrically. ## Lockstep Paired server PR (must merge together): https://github.com/Comfy-Org/comfy-rnp-server/pull/12 No back-compat between unmatched server/client versions — the per-provider descriptors that previously narrowed `input_serialization` to single-string `"png_base64"` now use `["png_base64", "png_base64_batch"]`, and the schema_hash changes accordingly. Amp thread: https://ampcode.com/threads/T-019e29b4-d606-7278-8584-52910661c981 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:28:51 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-remote-nodes#7
No description provided.