Can I rely on ComfyUI executing nodes in a particular order, and what do lazy inputs and node expansion change about caching and node IDs?
Problem. Workflows with side effects (file writes, counters, API calls) assume top-to-bottom order. Conditions. ComfyUI after PR #2666 (execution is a front-to-back topological sort); docs pages are undated. Method. The Execution Model Inversion Guide says order depends on node IDs and now also on which values are cached, and should be treated as non-deterministic beyond the graph's structure ('Don't rely on the execution order'). Lazy inputs ('lazy': True in INPUT_TYPES plus a check_lazy_status method that returns names of needed inputs) let a node skip evaluating whole upstream branches, so an upstream node may never run; check_lazy_status may be called several times. Node expansion lets a node return a subgraph at runtime (this is how loops work by tail recursion); each expanded node is cached separately, and the docs require expanded node IDs to be unique across the graph and deterministic between executions, including partial executions caused by caching. Execution blocking (Ex...
Structured fields
{
"citations": [
{
"url": "https://docs.comfy.org/development/comfyui-server/execution_model_inversion_guide.md",
"note": "Execution Order; ID rules; Defining check_lazy_status"
},
{
"url": "https://docs.comfy.org/custom-nodes/backend/expansion.md",
"note": "Execution Order; ID rules; Defining check_lazy_status"
},
{
"url": "https://docs.comfy.org/custom-nodes/backend/lazy_evaluation.md",
"note": "Execution Order; ID rules; Defining check_lazy_status"
}
]
}Evidence claims
- [sourced_fact] Problem. Workflows with side effects (file writes, counters, API calls) assume top-to-bottom order. Conditions. ComfyUI after PR #2666 (execution is a front-to-back topological sort); docs pages are undated. Method. The Execution Model Inversion Guide says order depends on node IDs and now also on which values are cached, and should be treated as non-deterministic beyond the graph's structure ('Don't rely on the execution order'). Lazy inputs ('lazy': True in INPUT_TYPES plus a check_lazy_status method that returns names of needed inputs) let a node skip evaluating whole upstream branches, so an upstream node may never run; check_lazy_status may be called several times. Node expansion lets a node return a subgraph at runtime (this is how loops work by tail recursion); each expanded node is cached separately, and the docs require expanded node IDs to be unique across the graph and deterministic between executions, including partial executions caused by caching. Execution blocking (ExecutionBlocker) is the way to disable an output node that has no lazy support. Failure modes. Order-dependent side effects, unstable generated IDs causing perpetual cache misses or collisions, and optional-input validation errors that earlier versions never raised. Limitations. Doc-level statements; not tested here. Version and date. Docs fetched 2026-10-23, undated; lazy evaluation stated as ComfyUI v0.2.0+. · locator: Execution Order; ID rules; Defining check_lazy_status source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |