BV Detailer While End (internal)
The hidden node that makes ComfyUI loop at all
- flow
- initial_value0
- loop_state
Of all the hidden nodes in the BV Detailer Loop, this one is the interesting half of the trick. BV Detailer While End (internal) is what makes a while loop exist in ComfyUI at all - and ComfyUI has no native loops. Every iteration of the BV detailer loop runs because this node, at queue time, clones the loop body and re-inserts itself into the graph. That's recursive graph expansion, and it's the mechanism under the whole feature.
You will never place this node. It's created during graph expansion, its category is __hidden__, and the pack's README is categorical: the recursive control nodes marked (internal) are implementation details and shouldn't be placed manually. But understanding it explains a lot about how the loop behaves, so here's the tour.
How it works
The node gets a flow wire from the while-start gate and a condition - the loop's "keep going?" signal. Plus an optional initial_value0, the loop state being carried. The branch is simple:
- Condition false → the loop is done. It returns
initial_value0- the loop state holding the accumulated image - and execution unwinds. - Condition true → the loop should run again. The node uses ComfyUI's
GraphBuilderto work out which nodes are inside the loop (everything between the while-start and itself, discovered via the dynamic prompt), clones that whole subgraph, rewires it to the current loop state, and re-expands the graph with a fresh copy of itself inside.
That last step is the recursion: the newly expanded copy will, when it runs, clone the body again if the condition is still true. Each job's index increments via the internal Loop Advance node, and eventually the condition flips false and the recursion stops.
Its output is loop_state, which in the closing branch is the final accumulated image's carrier - that's what the internal Loop Result node unwraps into the public BV Detailer Loop End's final_image.
Why this design exists
ComfyUI evaluates a static graph of nodes. There's no for loop in the engine, so the standard workaround - used by several packs, not just BV - is to make a node that expands itself at queue time: each "iteration" is literally a fresh copy of the loop body in the executed graph. It's why you sometimes see an (internal) node briefly appear during a run. It's a genuine design pattern, and it's what the flow + hidden dynprompt/unique_id inputs are for: the node has to discover, from the dynamic prompt, which nodes actually live between the loop's start and end.
What this means for you
Practically nothing, except context for debugging. If a BV detailer loop is running, this node (or its copies) appearing is the feature working. If a loop runs forever, the condition never went false - and since the condition is job_index < job_count, the usual culprit is a plan with more jobs than you expected, not a broken internal node. Check the BV Regional Detailer Plan's plan_summary, not the internals.
Installation is the pack, once:
cd ComfyUI/custom_nodes
git clone https://github.com/BlackVortexAI/bv_nodepack.git
(or ComfyUI Manager → BV Node Pack), then restart and hard-refresh. The internals take care of themselves.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| flow | FLOW_CONTROL | — | |
| condition | BOOLEAN | — | |
| initial_value0opt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| loop_state | * | — |