ComfyUI Node

Subworkflow Modifier

How to tweak a value mid-workflow without a circular reference

By eniewold·Created 4 months ago·Updated 12 days ago· 12
Subworkflow Modifier
  • value
  • value
slot_namemodifier

Subworkflow Modifier (class SWF_SubworkflowModifier, added in v1.1.0 of the eniewold/ComfyUI-Subworkflow pack) exists to solve one specific, frustrating problem: you want to expose a value from an inner workflow, modify it outside, and pass it back in - without ComfyUI throwing a circular reference error.

The classic case is LoRAs. Your inner workflow produces a model. You want to add LoRAs to that model, then hand the modified model back into the inner workflow for sampling. Naively that's a loop: the model leaves the inner workflow, gets modified, and re-enters it. ComfyUI hates that. The modifier node is the escape hatch.

How it works

Subworkflow Modifier lives inside the inner workflow. It takes an input value, passes it through to its output, and also makes it available as a "source" that a paired Subworkflow Modifier Source node can read from the outer workflow. You modify the value out there, then feed the result back into the modifier's input - and because the modified value travels through the source node rather than being wired straight back, the loop is broken.

In the author's words, the modifier's output reads the outer slot value, and its input publishes the modified value back out on the same slot. Concretely, that means the input you set:

  • slot_name - the label for the boundary, default modifier. Match it to what the value is (model, conditioning) so the outer slots are readable.
  • value - the modified value being passed back in. Like Subworkflow Input, this must be linked when the workflow runs standalone; it's only allowed to be unlinked inside a Subworkflow node.

Output is a single value passthrough.

Setting it up

Practically, the pair works like this:

  1. In the inner workflow, put a Subworkflow Modifier at the spot where the model (or whatever) exits.
  2. In the outer workflow, add a Subworkflow Modifier Source node pointing at the same workflow file - it exposes all the modifier slots as outputs.
  3. Wire the source output into your LoRA stack (or whatever modification), and wire the modified value back into the modifier's value input on the inner node.

The README's worked example is exactly this: modify the model with LoRAs and feed it back in. It's the node you only reach for when you hit the circular reference wall - and when you do, it's genuinely the difference between a workflow that works and one that won't queue.

The rest is pack-standard

Install via ComfyUI Manager ("Subworkflow (reuseable workflows)") or git clone https://github.com/eniewold/ComfyUI-Subworkflow.git into ComfyUI/custom_nodes, restart, hard-refresh. No pip dependencies; needs ComfyUI 0.18.x for the V3 node API. And a note for the edge cases: the whole pack is beta with AI-assisted code, and the modifier/source pair is the newest, least-tested corner of it - the "undetermined" slot ordering and silent link-severing known issues apply here too, so check your links if something goes grey.

CategorySubworkflow

Inputs (2)

NameTypeDefaultDescription
slot_nameSTRINGmodifier
valueoptCOMFY_MATCHTYPE_V3

Outputs (1)

NameTypeDescription
valueCOMFY_MATCHTYPE_V3