Nodes/ComfyCollectorNodes/Gate Any (CCN)
ComfyUI Node

Gate Any (CCN)

Mute a whole branch without bypassing a single node

By valkymaera·Created 4 months ago·Updated 10 days ago· 1
Gate Any (CCN)
  • value
  • value
enabledtrue
skip_upstreamtrue

Gate Any is the node you want when a workflow has a branch you keep turning off and on - an img2img refinement pass, a second sampling leg, a ControlNet chain you flip depending on the shot. The naive way is to right-click each node in the branch and hit Bypass, one at a time, then do it again in reverse when you change your mind. The Gate Any way is one boolean, and the branch vanishes from execution entirely.

The inputs are value (any type - it's a wildcard socket that accepts whatever you throw at it), enabled (the switch), and skip_upstream (the clever bit). When enabled, the gate passes value straight through. When disabled, it returns a special ExecutionBlocker sentinel that makes ComfyUI skip every node downstream - no error, just silence. The output socket still exists, but nothing flows into it.

Why skip_upstream is the real feature

Here's where Gate Any separates itself from a plain A/B switch. With skip_upstream on (the default), the gate also tells the executor it doesn't need the branch feeding value at all while the gate is closed. The node declares the input lazy, so ComfyUI only runs the upstream branch when the gate is actually open. That means a disabled gate doesn't just mute the output - it stops paying the GPU cost of the branch entirely. Turn off that ControlNet preprocessor and its model load and the whole thing skips, not just the final wire.

The trade-off is obvious: if your upstream branch has side effects you want to keep running (a save node, a counter, a prompt store write), leave skip_upstream off. The knowledge base's plumbing notes are worth repeating here: ComfyUI caches aggressively and identifies work backward from output nodes, so a gate that prunes an entire subtree is one of the few honest ways to speed up a workflow without deleting nodes.

Wiring it

Feed anything into value - an IMAGE, a LATENT, a conditioning, a string, whatever. You get the same thing back out as the value output when open. For the toggle, wire enabled from a primitive or a frontend switch so you can flip it without editing the graph, and you've got a physical kill-switch on a branch.

Install

Part of ComfyCollectorNodes, same as everything in the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/valkymaera/ComfyCollectorNodes

restart ComfyUI. In Manager, search ComfyCollectorNodes. No extra deps, no models.

The honest take

Gate Any is one of those tools that feels trivial until you need it, and then it's the whole workflow. The trap is forgetting skip_upstream exists: if you disable the gate and the branch still runs, that's the flag doing its job - flip it off if you genuinely want the branch executing (timers, counters) while its output is gated. And because the value socket is type-erased, a disabled gate leaves no trace in the graph about what kind of thing it was blocking - so name it well or you'll spend a minute each session remembering what it's gating.

CategoryComfyCollectorNodes/Utils

Inputs (3)

NameTypeDefaultDescription
value*Any value to pass through when the gate is enabled.
enabledBOOLEANtrueWhen off, downstream nodes are silently skipped.
skip_upstreamBOOLEANtrueWhen the gate is disabled, also skip executing the branch feeding 'value'.

Outputs (1)

NameTypeDescription
value*