Skip to content

Add io.DynamicGroup input + New LoRA Nodes (CORE-186) - #14507

Closed
Talmaj wants to merge 8 commits into
masterfrom
ListInput
Closed

Talmaj wants to merge 8 commits into
masterfrom
ListInput

Conversation

@Talmaj

@Talmaj Talmaj commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

io.DynamicGroup – repeatable widget-group input

What this adds

A new dynamic input type io.DynamicGroup (COMFY_DYNAMICGROUP_V3) that lets a node declare a repeatable group of widget fields. The frontend can render N rows of those fields; the backend reconstructs them into a list[dict] before calling execute.

Previously, Autogrow could repeat a single widget N times and DynamicCombo could show a different sub-schema per combo value, but nothing could repeat a group of widgets. io.DynamicGroup fills that gap.

Example

class LoraStacker(ComfyNode):
    @classmethod
    def define_schema(cls):
        return Schema(
            node_id="LoraStacker",
            inputs=[
                io.DynamicGroup.Input(
                    "loras",
                    template=[
                        io.Combo.Input("lora_name", options=folder_paths.get_filename_list("loras")),
                        io.Float.Input("strength", default=1.0, min=-10, max=10, step=0.01),
                    ],
                    min=0,
                    max=50,
                ),
            ],
        )

    @classmethod
    def execute(cls, loras: list[dict]):
        # loras = [{"lora_name": "foo.safetensors", "strength": 0.8}, ...]
        for row in loras:
            apply_lora(row["lora_name"], row["strength"])

How it works

  1. Schema – DynamicGroup.Input serializes a template (standard V1 input dict), min, and max into /object_info.
  2. Frontend – reads COMFY_DYNAMICGROUP_V3, renders stackable rows, submits flat keys: loras.0.lora_name, loras.0.strength, loras.1.lora_name, …
  3. Expansion – at execution time DynamicGroup._expand_schema_for_dynamic scans live_inputs to determine the current row count, registers each {groupId}.{row}.{fieldId} slot in required/optional, and records the group root in list_paths.
  4. Reconstruction – build_nested_inputs collects the flat values into {0: {…}, 1: {…}}, then a post-pass converts every list_paths entry to a sorted list[dict].

Parameters

Parameter Default Notes
template required list[WidgetInput] – the fields in each row
min 0 Rows below this count are required (non-removable in UI)
max 50 Hard cap; absolute max is 100

Limitations

  • Frontend work required – the repeatable-row UI needs a matching change in comfyui-frontend-package. Until then the schema is served correctly but rows won't stack in the UI.
  • Widget-only template – template fields must be WidgetInput subclasses (Combo, Float, Int, String, Boolean, Color). Plain socket inputs and nested dynamic types (DynamicGroup, Autogrow, DynamicCombo) are not allowed.
  • Top-level groups only – io.DynamicGroup cannot be nested inside another io.DynamicGroup or Autogrow.

Files changed

  • comfy_api/latest/_io.py – DynamicGroup class, DynamicPathsDefaultValue.EMPTY_LIST, list_paths in V3Data/get_finalized_class_inputs, list post-pass in build_nested_inputs, registered in setup_dynamic_input_funcs, exported in __all__
  • tests-unit/comfy_api_test/io_dynamic_group_test.py – 18 unit tests covering schema construction, 0-row, N-row, sort order, min enforcement, partial values, and no-leftover-flat-keys

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds DynamicGroup in comfy_api/latest/_io.py with template validation, per-row dynamic schema expansion, and an EMPTY_LIST default for empty groups. Parser setup registers DynamicGroup.io_type; V3Data and get_finalized_class_inputs() now track list_paths, and build_nested_inputs reconstructs index-keyed dict leaves into sorted lists or empty lists for missing roots. A new unit test module covers constructor validation, zero-row and multi-row reconstruction, row ordering, and output cleanup.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title names the new io.DynamicGroup input, which is the main change, though the LoRA nodes mention is extra.
Description check ✅ Passed The description clearly explains the DynamicGroup feature and its implementation details, matching the changeset.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@comfy_api/latest/_io.py`:
- Line 1366: The row_count calculation at the line with max(min_rows,
present_rows) does not enforce the max parameter that was serialized in
as_dict(). Read the max parameter from the List.Input object and modify the
row_count assignment to cap it so that row_count respects both the minimum
constraint (min_rows) and the maximum constraint (max parameter). This ensures
that row_count falls within the allowed range and prevents the backend from
accepting row indices beyond the specified maximum.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cd605340-c975-4ad9-8610-e97f9f52618f

📥 Commits

Reviewing files that changed from the base of the PR and between 90eeeb2 and a3b9cf8.

📒 Files selected for processing (2)
  • comfy_api/latest/_io.py
  • tests-unit/comfy_api_test/io_list_test.py

Comment thread comfy_api/latest/_io.py Resolved
@Talmaj Talmaj changed the title Add io.List input Add io.DynamicGroup input Jun 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests-unit/comfy_api_test/io_dynamic_group_test.py (1)

198-204: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for max overflow.

The implementation now rejects live rows beyond max, but this error path is not covered. A small test locks the backend cap contract.

Proposed test
     def test_no_leftover_flat_keys(self):
         """Flat keys must be consumed; only the reconstructed list remains."""
         inp = DynamicGroup.Input("rows", template=[Float.Input("x", default=0.0)], min=0, max=5)
         result = _run(inp, {"rows.0.x": 1.0, "rows.1.x": 2.0})
         assert "rows.0.x" not in result
         assert "rows.1.x" not in result
         assert isinstance(result["rows"], list)
+
+    def test_rows_beyond_max_raise(self):
+        inp = DynamicGroup.Input("rows", template=[Float.Input("x", default=0.0)], min=0, max=2)
+
+        with pytest.raises(ValueError):
+            get_finalized_class_inputs(_make_class_inputs(inp), {"rows.2.x": 1.0})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests-unit/comfy_api_test/io_dynamic_group_test.py` around lines 198 - 204,
Add a regression test in io_dynamic_group_test around DynamicGroup.Input/_run
that covers the max overflow path: create a group with a small max and submit
more indexed rows than allowed, then assert the backend rejects the extra row(s)
instead of reconstructing them. Reuse the existing test helpers and symbols like
test_no_leftover_flat_keys, DynamicGroup.Input, and _run so the new case sits
alongside the current flat-key coverage and verifies the cap contract
explicitly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@comfy_api/latest/_io.py`:
- Around line 1305-1308: The DynamicGroup ID validation currently checks only
for uniqueness, but it also needs to reject any “.” characters in both group IDs
and template field IDs because slot_id encoding and path.split(".") decoding
will rebuild the wrong nested row shape. Update the DynamicGroup validation
logic around field_ids and the related DynamicGroup ID handling paths to assert
that neither the group id nor any template field id contains ".", and surface a
clear validation error before rows are encoded or decoded.

---

Nitpick comments:
In `@tests-unit/comfy_api_test/io_dynamic_group_test.py`:
- Around line 198-204: Add a regression test in io_dynamic_group_test around
DynamicGroup.Input/_run that covers the max overflow path: create a group with a
small max and submit more indexed rows than allowed, then assert the backend
rejects the extra row(s) instead of reconstructing them. Reuse the existing test
helpers and symbols like test_no_leftover_flat_keys, DynamicGroup.Input, and
_run so the new case sits alongside the current flat-key coverage and verifies
the cap contract explicitly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7cdfa785-547c-4784-a1bd-881bbd413d05

📥 Commits

Reviewing files that changed from the base of the PR and between a3b9cf8 and abd185c.

📒 Files selected for processing (2)
  • comfy_api/latest/_io.py
  • tests-unit/comfy_api_test/io_dynamic_group_test.py

Comment thread comfy_api/latest/_io.py Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
comfy_api/latest/_io.py (1)

1376-1386: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject malformed DynamicGroup row keys during expansion.

loras.-1.strength is silently ignored, while loras.0.unknown still increments present_rows; both can drop submitted values or reconstruct blank rows. Validate canonical non-negative row indices and known template fields before counting the row.

Proposed validation
         # Determine how many rows are currently present by scanning live_inputs
         finalized_prefix = finalize_prefix(curr_prefix)
+        valid_field_ids = {field_id for field_id, _, _ in field_specs}
         present_rows = 0
         for live_key in live_inputs:
             # Keys look like "<prefix>.<row>.<field_id>"
             if live_key.startswith(finalized_prefix + "."):
                 remainder = live_key[len(finalized_prefix) + 1:]
                 parts = remainder.split(".", 1)
-                if len(parts) >= 1:
-                    try:
-                        row_idx = int(parts[0])
-                        present_rows = max(present_rows, row_idx + 1)
-                    except ValueError:
-                        pass
+                if len(parts) != 2 or parts[1] not in valid_field_ids:
+                    raise ValueError(f"Invalid DynamicGroup input key: '{live_key}'.")
+                try:
+                    row_idx = int(parts[0])
+                except ValueError as exc:
+                    raise ValueError(f"Invalid DynamicGroup row index in key: '{live_key}'.") from exc
+                if row_idx < 0 or str(row_idx) != parts[0]:
+                    raise ValueError(f"Invalid DynamicGroup row index in key: '{live_key}'.")
+                present_rows = max(present_rows, row_idx + 1)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@comfy_api/latest/_io.py` around lines 1376 - 1386, The DynamicGroup row-key
handling in the live_inputs expansion logic accepts malformed keys and can count
invalid rows; update the parsing in _io.py’s expansion block to validate that
keys match the canonical non-negative row format before affecting present_rows.
Specifically, in the loop that processes live_key and derives row_idx, reject
negative or non-canonical indices and ensure the field name exists in the
DynamicGroup template before incrementing present_rows, so malformed entries
like loras.-1.strength or unknown fields do not influence row reconstruction.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@comfy_api/latest/_io.py`:
- Around line 1376-1386: The DynamicGroup row-key handling in the live_inputs
expansion logic accepts malformed keys and can count invalid rows; update the
parsing in _io.py’s expansion block to validate that keys match the canonical
non-negative row format before affecting present_rows. Specifically, in the loop
that processes live_key and derives row_idx, reject negative or non-canonical
indices and ensure the field name exists in the DynamicGroup template before
incrementing present_rows, so malformed entries like loras.-1.strength or
unknown fields do not influence row reconstruction.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e11c5629-30a4-4d19-aa3a-44889b562cf9

📥 Commits

Reviewing files that changed from the base of the PR and between 30b19c6 and 330a37d.

📒 Files selected for processing (1)
  • comfy_api/latest/_io.py

@alexisrolland

Copy link
Copy Markdown
Member

@Talmaj could you pleaser run a review of these changes with your agent based on AGENT.md. I think this could use some clean-up.

@Talmaj

Talmaj commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@Talmaj could you pleaser run a review of these changes with your agent based on AGENT.md. I think this could use some clean-up.

I've done it. AI wanted to remove lots of comments and docstrings. I removed some, but decided for keeping the informative ones.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@comfy_api/latest/_io.py`:
- Around line 1380-1384: Reject malformed DynamicGroup row keys in the parsing
logic so invalid segments like loras.foo.x do not get silently ignored, and
ensure the DynamicGroup data handed to execute() always matches the promised
list[dict] contract. Update the relevant parsing/normalization code in _io.py
around the row-key handling and the code path that can leave a dict in place of
a list, and replace the silent continue/pass behavior with a clear ValueError
that surfaces the bad state immediately.

In `@tests-unit/comfy_api_test/io_dynamic_group_test.py`:
- Around line 6-10: The test setup in io_dynamic_group_test.py is shadowing a
real installed torch package by only checking sys.modules before creating the
stub. Update the torch stub guard in the test module so it first verifies torch
is truly unavailable using importlib.util.find_spec("torch") is None, and only
then injects the _torch_stub into sys.modules; keep the existing Tensor
attribute stub behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 67a6cb25-6bf3-4768-a50f-85cc54060827

📥 Commits

Reviewing files that changed from the base of the PR and between 330a37d and fa585a8.

📒 Files selected for processing (2)
  • comfy_api/latest/_io.py
  • tests-unit/comfy_api_test/io_dynamic_group_test.py
📜 Review details
⏰ Context from checks skipped due to timeout. (8)
  • GitHub Check: test (macos-latest)
  • GitHub Check: test (windows-latest)
  • GitHub Check: test (ubuntu-latest)
  • GitHub Check: test (windows-2022)
  • GitHub Check: test (macos-latest)
  • GitHub Check: test (ubuntu-latest)
  • GitHub Check: Run Pylint
  • GitHub Check: Run Pylint
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Keep imports at module scope; avoid inline imports unless they are already part of an established optional-backend probe or are needed to avoid an import cycle.
Do not add unnecessary try/except blocks; use them only for optional dependency, platform, or backend capability detection when the program has a useful fallback, and prefer specific exception types when changing new code.
Remove workarounds for PyTorch versions that ComfyUI no longer officially supports; if a workaround does not have a comment naming the exact supported PyTorch version(s), remove it.
Let unsupported model formats, invalid quantization metadata, and bad states fail with clear errors instead of silently producing lower quality output.
Match the existing local style in the file you edit; this codebase tolerates long lines, simple helper functions, module-level state, and direct tensor operations when they make the code easier to follow.
Keep comments sparse and useful; strip useless comments that restate the code or describe obvious behavior, while allowing short TODOs that name the concrete missing follow-up.
Treat dtype, device placement, VRAM usage, and offloading behavior as core correctness concerns; check CPU, CUDA, ROCm, MPS, DirectML, XPU, NPU, and low VRAM implications when touching shared execution or loading code.
Prefer native ComfyUI formats and existing quantization/offload helpers over adding parallel code paths; use comfy.quant_ops, comfy.model_management, comfy.memory_management, comfy.pinned_memory, comfy_aimdo, and comfy-kitchen helpers where they already solve the problem.
Use optimized comfy-kitchen ops where they improve performance without changing expected dtype, device, memory, or interface behavior.
All models should use the optimized attention function selected by ComfyUI; higher-level code must not inspect function identity, names, modules, or implementation details to decide behavior.
Apply the same opacity rule to similar patterns beyond...

Files:

  • tests-unit/comfy_api_test/io_dynamic_group_test.py
  • comfy_api/latest/_io.py
**

⚙️ CodeRabbit configuration file

**: ## Engineering Style

  • Keep changes small and direct. Most fixes should touch the narrowest code path
    that explains the bug, performance issue, dtype issue, model-format issue, or
    user-facing behavior.
  • Change the least amount of files possible. A change that touches many files is
    more likely to be a bad change than a good one unless the broader scope is
    directly required.
  • Prefer practical fixes over broad architecture work. Add abstractions only
    when they remove real repeated logic or match an existing ComfyUI pattern.
  • Prefer fewer dependencies. Do not add new dependencies to ComfyUI unless they
    are absolutely necessary.
  • Delete obsolete code aggressively when newer infrastructure makes it useless.
    Remove dead fallbacks, migration paths, unused options, debug prints, and
    compatibility branches that are no longer needed. Do not leave dead branches,
    unreachable code, or functions that are never called. If code is not
    necessary for the current behavior, remove it.
  • Revert or disable problematic behavior quickly when it breaks users. It is
    better to remove a broken feature path than keep a complicated partial fix.
  • Preserve existing APIs, node names, model-loading behavior, file layout, and
    workflow compatibility unless the change is explicitly about replacing them.
  • Code must look hand-written for this repository. Changes that read like
    generic AI-generated code will be rejected automatically: unnecessary helper
    layers, vague names, boilerplate comments, defensive branches without a real
    failure mode, broad rewrites, or code that ignores the local style.

Architecture Boundaries

  • Keep each layer focused on the concepts it owns. Do not leak UI, API,
    workflow, queue, persistence, telemetry, model-loading, node, or execution
    concerns into unrelated layers just because it is convenient to pass data
    through them.
  • Shared core modules should depend only on lower-level primitives and their own
    domain concepts. Highe...

Files:

  • tests-unit/comfy_api_test/io_dynamic_group_test.py
  • comfy_api/latest/_io.py

⚙️ CodeRabbit configuration file

**: IMPORTANT: Only comment on issues directly introduced by this PR's code changes.
Treat AGENTS.md as mandatory repository policy, not optional style guidance.
Flag PR changes that violate AGENTS.md even when the code is otherwise functional.
In particular, enforce architecture boundaries, dtype/device/memory rules,
interface contracts, import style, no unnecessary try/except blocks, no inline
imports, no outbound internet paths in core ComfyUI, and narrow scoped fixes.
Prefer direct findings over suggestions when a rule is violated. Only ignore
AGENTS.md when it clearly conflicts with a newer explicit maintainer instruction
in the PR.
Do NOT flag pre-existing issues in code that was merely moved, re-indented,
de-indented, or reformatted without logic changes. If code appears in the diff
only due to whitespace or structural reformatting (e.g., removing a with: block),
treat it as unchanged. Contributors should not feel obligated to address
pre-existing issues outside the scope of their contribution.

Files:

  • tests-unit/comfy_api_test/io_dynamic_group_test.py
  • comfy_api/latest/_io.py
🧠 Learnings (1)
📚 Learning: 2026-02-21T14:01:41.482Z
Learnt from: pythongosssss
Repo: Comfy-Org/ComfyUI PR: 12555
File: comfy_extras/nodes_glsl.py:719-724
Timestamp: 2026-02-21T14:01:41.482Z
Learning: In PyOpenGL, bare Python scalars can be accepted for 1-element array parameters by NumberHandler. This means you can pass an int/float directly to OpenGL texture deletion (e.g., glDeleteTextures(tex)) without wrapping in a list. Verify function-specific expectations and ensure types match what the OpenGL call expects; use explicit lists only when the API requires an array.

Applied to files:

  • tests-unit/comfy_api_test/io_dynamic_group_test.py
  • comfy_api/latest/_io.py
🔇 Additional comments (2)
comfy_api/latest/_io.py (1)

1264-1379: LGTM!

Also applies to: 1385-1412, 1570-1571, 1583-1584, 1926-1945, 1981-2032, 2040-2045, 2610-2612

tests-unit/comfy_api_test/io_dynamic_group_test.py (1)

1-5: LGTM!

Also applies to: 12-205

Comment thread comfy_api/latest/_io.py
Comment on lines +1380 to +1384
try:
row_idx = int(parts[0])
present_rows = max(present_rows, row_idx + 1)
except ValueError:
pass

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject malformed DynamicGroup row keys instead of silently continuing.

Line 1383 ignores invalid row segments like loras.foo.x, and Line 2037 can leave a dict in place of the promised list[dict]. Fail with a clear ValueError so bad DynamicGroup state does not leak into execute().

As per coding guidelines, “Do not add unnecessary try/except blocks” and “Let ... bad states fail with clear errors.” As per path instructions, AGENTS.md requires preserving interface contracts and avoiding unnecessary try/except blocks.

Proposed fix
-                    try:
-                        row_idx = int(parts[0])
-                        present_rows = max(present_rows, row_idx + 1)
-                    except ValueError:
-                        pass
+                    if not parts[0].isdecimal():
+                        raise ValueError(
+                            f"DynamicGroup input '{finalized_prefix}' received invalid row key '{parts[0]}'."
+                        )
+                    row_idx = int(parts[0])
+                    present_rows = max(present_rows, row_idx + 1)
@@
         if isinstance(leaf, dict):
-            try:
-                sorted_rows = [leaf[k] for k in sorted(leaf.keys(), key=int)]
-                container[leaf_key] = sorted_rows
-            except (ValueError, TypeError):
-                # Keys are not all integers; leave as-is
-                pass
+            if not all(isinstance(k, str) and k.isdecimal() for k in leaf):
+                raise ValueError(f"DynamicGroup path '{list_path}' contains non-integer row keys: {list(leaf.keys())}")
+            sorted_rows = [leaf[k] for k in sorted(leaf.keys(), key=int)]
+            container[leaf_key] = sorted_rows

Also applies to: 2033-2039

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@comfy_api/latest/_io.py` around lines 1380 - 1384, Reject malformed
DynamicGroup row keys in the parsing logic so invalid segments like loras.foo.x
do not get silently ignored, and ensure the DynamicGroup data handed to
execute() always matches the promised list[dict] contract. Update the relevant
parsing/normalization code in _io.py around the row-key handling and the code
path that can leave a dict in place of a list, and replace the silent
continue/pass behavior with a clear ValueError that surfaces the bad state
immediately.

Sources: Coding guidelines, Path instructions

Comment on lines +6 to +10
# Stub torch (type-hint only in _io.py; real torch not available in unit-test env)
if "torch" not in sys.modules:
_torch_stub = types.ModuleType("torch")
_torch_stub.Tensor = object # type: ignore[attr-defined]
sys.modules["torch"] = _torch_stub

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether the current test environment has torch installed but not loaded.
python - <<'PY'
import importlib.util, sys
print("torch_installed=", importlib.util.find_spec("torch") is not None)
print("torch_loaded=", "torch" in sys.modules)
PY

Repository: Comfy-Org/ComfyUI

Length of output: 197


Avoid shadowing an installed torch module
This stub runs whenever torch is only unloaded, so an installed-but-unimported PyTorch gets replaced for the rest of the test session. Gate it on importlib.util.find_spec("torch") is None so only missing installs are mocked.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests-unit/comfy_api_test/io_dynamic_group_test.py` around lines 6 - 10, The
test setup in io_dynamic_group_test.py is shadowing a real installed torch
package by only checking sys.modules before creating the stub. Update the torch
stub guard in the test module so it first verifies torch is truly unavailable
using importlib.util.find_spec("torch") is None, and only then injects the
_torch_stub into sys.modules; keep the existing Tensor attribute stub behavior
unchanged.

Source: Path instructions

@alexisrolland alexisrolland changed the title Add io.DynamicGroup input Add io.DynamicGroup input (CORE-186) Jul 6, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution, we really appreciate it! 🎉

Like many open source projects, we require contributors to sign our Contributor License Agreement (CLA). A CLA makes the ownership of contributions explicit, so contributors and the project share a clear understanding of how the code can be used. By signing, you:

  • Confirm that you own your contribution.
  • Keep the right to reuse your own code.
  • Grant us a copyright license to include and share it within our projects.

CLAs are standard practice across major open source projects including those under the Apache Software Foundation and the Linux Foundation. Ours is based on the Apache Software Foundation's CLA. Most importantly, it would enable us to relicense the project under a more permissive license in the future, giving the project and its community greater flexibility.

✍ To sign, please post a new comment on this PR with exactly the following text: ✍


I have read and agree to the Contributor License Agreement


1 out of 2 committers have signed the CLA.
✅ (Talmaj)[https://github.com/Talmaj]
❌ @Talmaj Marinc
Talmaj Marinc seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@alexisrolland

Copy link
Copy Markdown
Member

Reposting feedback on this from the previous PR #14655

Comparison of results between these new LoRA nodes and the previous ones. They look close enough although some pixels are changing a bit

Workflow: sdxl_lora_comparison.json

{8CD23559-A875-4735-BAAA-E2A299AB18CD}

New nodes results:

image

Previous nodes results:

image

@alexisrolland

Copy link
Copy Markdown
Member

@Talmaj there are a lot of warnings in the logs that seem abnormal:

[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_attn2_to_q.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_attn2_to_q.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_attn2_to_v.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_attn2_to_v.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_attn2_to_v.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_ff_net_0_proj.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_ff_net_0_proj.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_ff_net_0_proj.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_ff_net_2.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_ff_net_2.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_0_ff_net_2.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_k.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_k.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_k.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_out_0.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_out_0.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_out_0.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_q.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_q.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_q.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_v.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_v.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn1_to_v.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_k.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_k.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_k.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_out_0.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_out_0.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_out_0.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_q.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_q.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_q.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_v.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_v.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_attn2_to_v.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_ff_net_0_proj.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_ff_net_0_proj.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_ff_net_0_proj.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_ff_net_2.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_ff_net_2.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_4_1_transformer_blocks_1_ff_net_2.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_proj_in.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_proj_in.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_proj_in.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_proj_out.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_proj_out.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_proj_out.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_k.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_k.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_k.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_out_0.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_out_0.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_out_0.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_q.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_q.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_q.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_v.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_v.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn1_to_v.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_k.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_k.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_k.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_out_0.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_out_0.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_out_0.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_q.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_q.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_q.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_v.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_v.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_attn2_to_v.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_ff_net_0_proj.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_ff_net_0_proj.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_ff_net_0_proj.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_ff_net_2.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_ff_net_2.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_0_ff_net_2.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_k.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_k.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_k.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_out_0.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_out_0.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_out_0.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_q.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_q.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_q.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_v.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_v.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn1_to_v.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_k.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_k.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_k.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_out_0.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_out_0.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_out_0.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_q.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_q.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_q.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_v.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_v.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_attn2_to_v.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_ff_net_0_proj.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_ff_net_0_proj.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_ff_net_0_proj.lora_up.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_ff_net_2.alpha
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_ff_net_2.lora_down.weight
[WARNING] lora key not loaded: lora_unet_output_blocks_5_1_transformer_blocks_1_ff_net_2.lora_up.weight
[INFO] Requested to load SDXLClipModel

@alexisrolland alexisrolland changed the title Add io.DynamicGroup input (CORE-186) Add io.DynamicGroup input + New LoRA Nodes (CORE-186) Jul 9, 2026
@alexisrolland

Copy link
Copy Markdown
Member

recheck

@alexisrolland

Copy link
Copy Markdown
Member

Superseded by #16309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants