fix: use _load_module_temp for bootstrap modules to avoid sys.modules conflicts

bootstrap_comfyui_runtime() now uses _load_module_temp() with temporary
module names (_bootstrap_options, _bootstrap_cli_args, _bootstrap_cuda_malloc)
instead of real module names. This prevents cached stale modules from
sys.modules conflicting with ComfyUI's internal import chain (e.g.
nodes.py -> comfy.sd -> comfy.model_management -> comfy.cli_args).

Fixes the text-to-image runtime e2e failure:
  ImportError: cannot import name 'args' from 'comfy.cli_args'
This commit is contained in:
Peyton DeNiro
2026-05-10 00:31:02 -05:00
parent 49649a6745
commit 3ec60ded7d
5 changed files with 177 additions and 55 deletions
@@ -2,6 +2,7 @@ from ..node_runtime import (
_find_from_extension_location,
_is_comfyui_directory,
_load_module,
_load_module_temp,
add_comfyui_directory_to_sys_path,
add_extra_model_paths,
bootstrap_comfyui_runtime,
@@ -15,6 +16,7 @@ __all__ = [
"_find_from_extension_location",
"_is_comfyui_directory",
"_load_module",
"_load_module_temp",
"add_comfyui_directory_to_sys_path",
"add_extra_model_paths",
"bootstrap_comfyui_runtime",
+2
View File
@@ -9,6 +9,7 @@ from .generated_helpers import (
_find_from_extension_location,
_is_comfyui_directory,
_load_module,
_load_module_temp,
add_comfyui_directory_to_sys_path,
add_extra_model_paths,
bootstrap_comfyui_runtime,
@@ -35,6 +36,7 @@ class WorkflowRenderer:
func_strings = []
for func in [
_load_module,
_load_module_temp,
_is_comfyui_directory,
_find_from_extension_location,
get_value_at_index,