fix: load comfy_extras nodes even when server.py import fails

server.py cannot load due to a ComfyUI internal module shadowing bug
(comfy/utils.py file shadows utils/ package). Decouple init_extra_nodes()
from server.py loading so NODE_CLASS_MAPPINGS still gets populated from
comfy_extras (UpscaleModelLoader, etc.) even without full PromptServer setup.

Also fix app.py to re-read from cached sys.modules[nodes] after
import_custom_nodes() instead of using stale initial copy.

Fixes the upscale-model-loader runtime e2e test.
This commit is contained in:
Peyton DeNiro
2026-05-10 00:45:13 -05:00
parent 3ec60ded7d
commit e569e361a6
3 changed files with 202 additions and 56 deletions
+8 -1
View File
@@ -261,7 +261,14 @@ def import_custom_nodes() -> None:
server_mod = _load_module("server", os.path.join(comfyui_path, "server.py"))
if execution_mod is None or server_mod is None:
log.debug("import_custom_nodes: could not load required modules")
log.debug(
"import_custom_nodes: could not load execution/server modules. "
"Proceeding without full PromptServer/PromptQueue setup."
)
# Even without server, we can still populate NODE_CLASS_MAPPINGS from
# comfy_extras and built-in extra nodes.
if nodes_mod is not None and hasattr(nodes_mod, "init_extra_nodes"):
asyncio.run(nodes_mod.init_extra_nodes())
return
loop = asyncio.new_event_loop()