Preserve IC-LoRA metadata when composing multiple LoRAs
Problem
Composing multiple metadata-bearing LoRAs retains their patches but only retains the last nonempty lora_metadata attachment. If an IC-LoRA is followed by another LoRA with unrelated metadata, GetICLoRAParameters can no longer find the earlier reference_downscale_factor and falls back to 1.
This is a shared loader behavior, not specific to DynamicGroup: sequential existing LoraLoader nodes and the proposed native stack both call comfy.sd.load_lora_for_models.
Reproduction path
- Apply an IC-LoRA whose metadata contains a
reference_downscale_factorgreater than 1. - Apply another LoRA with nonempty metadata that does not contain that parameter to the resulting model.
- Pass the final model to
GetICLoRAParameters.
The shared loader clones the patched model and replaces its single lora_metadata attachment. GetICLoRAParameters reads that attachment, so the earlier IC-LoRA's parameter is no longer available even though its patches remain active. This report is based on the code path, not a full image-generation reproduction.
Follow-up scope
- Define how metadata from multiple applied LoRAs is retained and how a consumer selects the intended LoRA's parameters. Do not assume blindly merging dictionaries is correct when multiple IC-LoRAs provide conflicting values.
- Keep the single-LoRA behavior compatible and apply the chosen contract consistently to sequential loaders and native stacks. The shared helper also has a CLIP attachment path that should follow the chosen policy where applicable.
- Add regressions for IC-LoRA followed by unrelated metadata, a later LoRA without metadata, and conflicting IC-LoRA parameters. Verify that patch composition remains unchanged.
Origin: ComfyUI #16309, feat: add native LoRA stack loader nodes, metadata review comment.
Relevant code: comfy/sd.py::load_lora_for_models, comfy/model_patcher.py::set_attachments, and comfy_extras/nodes_lt.py::GetICLoRAParameters.
Unassigning myself: the IC-LoRA metadata is dropped in the Python comfy.sd.load_lora_for_models path, so this needs a core/backend owner rather than a frontend engineer.