Execution Gate (EnhUtils)
Skip an expensive branch without breaking your queue
- value
- value
What it actually does
You have a branch you don't always want to run. An LLM writes a prompt, a length check decides if it's garbage, and only good prompts should hit a 30-second sampler.
ComfyUI's built-in answers are all mildly wrong for this. Mute and bypass are manual - fine if you decide, useless when the decision depends on data. An A/B switch still executes both inputs and throws one away, so the expensive branch runs regardless. Impact Pack's Control Bridge in Stop mode does work, but it's an output node, so ComfyUI treats its whole upstream chain as required: your LLM runs on every queue, even the runs where you discard its text.
The Execution Gate is a plain (non-output) node that either passes data through or silently stops the branch. No error, no interrupted queue, and nothing upstream of the gate runs when it's blocked. That last part is the whole point.
How it works
Two native ComfyUI mechanisms, no node-ID lookups and no mute/bypass fiddling:
valueis a lazy input. ComfyUI doesn't add lazy links to a node's dependencies until the node asks for them. The gate implementscheck_lazy_status(), returning["value"]whenenabledis true and an empty list when it isn't. Gate off meansvalueis never requested, so the nodes feeding it never execute at all.- The block is an
ExecutionBlocker. The disabled path returnsExecutionBlocker(None)as a positional result; any node receiving a blocker is skipped and forwards it down the wire. TheNonemessage is what makes it silent - noexecution_errorevent, so auto-queue keeps rolling instead of halting on you. Normal dead-branch pruning still applies, so if the gate's output doesn't reach a real output node, neither the gate nor anything behind it runs. That's why it can be cheap where Control Bridge isn't.
A silent block looks exactly like the dozen other reasons a branch didn't run, so the author makes the node announce itself: blocked gates log an INFO line to the console and return ui={"blocked": [True]}, which js/executionGate.js turns into an "Execution Gate: blocked" warning toast. Purely informational.
The two inputs
There are only two, which is why this node gets misread as useless.
enabled - a boolean, default true, labelled pass through / block on the widget. Wire a computed boolean in (right-click the widget → Convert to input) or flip it by hand to test. If that boolean comes from a node that might not run, the gate won't run either; the chain has to be live.
value - the thing being gated, and it's a type-match socket, so it adopts whatever type you plug in. String, latent, image batch, whatever; the same Python object comes out the other side. Because it's lazy, a disabled gate never even asks for it.
The single output, value, is the input passed through unchanged - or, when blocked, the silent blocker. Wire it into whatever the branch was feeding. That connection isn't optional: break it and the gate gets pruned, and then nothing runs even when enabled is true.
Put the gate before the expensive thing. Typical shape: text → check → boolean → gate.enabled, with text → gate.value and gate.value → KSampler.
Install
ComfyUI Manager, search "Enhancement Utils". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/phazei/ComfyUI-Enhancement-Utils.git
pip install -r requirements.txt
That's it - requirements.txt is two lines, psutil and piexif. No models, no download step. nvidia-ml-py is optional, only for the pack's GPU monitor bars. (Don't install the separate pynvml package; it's a deprecated shim over nvidia-ml-py that prints a FutureWarning.)
The catch: you're installing the whole pack, not just this node - resource monitor, profiler badges, graph auto-arrange, node navigation, Play Sound, an image loader with subfolder scanning. Great if you want them, noise if you don't, and it deliberately duplicates features from ComfyUI-Custom-Scripts and Crystools, so running all three gets you two monitors and two "Go to Node" menu entries.
The nodes are written against ComfyUI's V3 API (comfy_api.latest), so you need a reasonably current install - an old one may load the pack and register nothing.
Where people get tripped up
"I toggled it off and got nothing - not even a toast." The gate's output probably doesn't reach an output node, so the whole branch was pruned, gate included. It can't be the end of your graph.
"My upstream node still runs when the gate is off." Either it feeds something else that's still live, or you put the gate after the thing you meant to skip. Lazy evaluation only spares nodes that exclusively feed value.
"I expected an error." It's silent on purpose. For a hard stop with a red node and a broken queue, this is the wrong tool.
"The value socket won't connect." The type-match template locks onto the first connected type. Disconnect and re-plug to let it re-adopt.
If you're building graphs that decide things rather than just run pipelines, this is the cleanest gate around: one job, works inside subgraphs, and it never holds your queue hostage.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| enabled | BOOLEAN | true | When true, evaluates and passes through 'value'. When false, 'value' is not evaluated and downstream execution is silently blocked. |
| value | COMFY_MATCHTYPE_V3 | Value to pass through when 'enabled' is true. Not evaluated when 'enabled' is false. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | COMFY_MATCHTYPE_V3 | The original 'value' when enabled, or a silent execution blocker when disabled. |