diff --git a/comfyui_modal_sync_cloud.py b/comfyui_modal_sync_cloud.py index 5027076..3eb02c8 100644 --- a/comfyui_modal_sync_cloud.py +++ b/comfyui_modal_sync_cloud.py @@ -1185,19 +1185,19 @@ def _extract_prompt_executor_error(executor: Any) -> str: def _normalize_link_output_index(value: Any) -> Any: """Unwrap a singleton list around a prompt-link output index when present.""" - if isinstance(value, list) and len(value) == 1 and isinstance(value[0], int | float): - return value[0] + while isinstance(value, list) and len(value) == 1: + value = value[0] return value def _normalize_prompt_input_value(value: Any) -> Any: """Unwrap transport-added singleton lists around scalar prompt input values.""" + while isinstance(value, list) and len(value) == 1: + value = value[0] if isinstance(value, list) and len(value) == 2 and isinstance(value[0], str): return [value[0], _normalize_link_output_index(value[1])] - if isinstance(value, list) and len(value) == 1: - candidate = value[0] - if candidate is None or isinstance(candidate, bool | int | float | str): - return candidate + if value is None or isinstance(value, bool | int | float | str): + return value return value diff --git a/remote/modal_app.py b/remote/modal_app.py index c0d7074..9dd4120 100644 --- a/remote/modal_app.py +++ b/remote/modal_app.py @@ -266,19 +266,19 @@ def _is_link(value: Any) -> bool: def _normalize_link_output_index(value: Any) -> Any: """Unwrap a singleton list around a prompt-link output index when present.""" - if isinstance(value, list) and len(value) == 1 and isinstance(value[0], int | float): - return value[0] + while isinstance(value, list) and len(value) == 1: + value = value[0] return value def _normalize_prompt_input_value(value: Any) -> Any: """Unwrap transport-added singleton lists around scalar prompt input values.""" + while isinstance(value, list) and len(value) == 1: + value = value[0] if isinstance(value, list) and len(value) == 2 and isinstance(value[0], str): return [value[0], _normalize_link_output_index(value[1])] - if isinstance(value, list) and len(value) == 1: - candidate = value[0] - if candidate is None or isinstance(candidate, bool | int | float | str): - return candidate + if value is None or isinstance(value, bool | int | float | str): + return value return value diff --git a/tests/test_modal_executor_node.py b/tests/test_modal_executor_node.py index ff84749..966106e 100644 --- a/tests/test_modal_executor_node.py +++ b/tests/test_modal_executor_node.py @@ -2498,7 +2498,7 @@ def test_local_remote_app_normalizes_wrapped_subgraph_link_indexes( }, "remote_2": { "class_type": "BoundarySink", - "inputs": {"value": ["remote_1", [0]]}, + "inputs": {"value": [[["remote_1", [0]]]]}, "_meta": {}, }, }, @@ -2512,7 +2512,7 @@ def test_local_remote_app_normalizes_wrapped_subgraph_link_indexes( { "proxy_output_name": "remote_2_value", "node_id": "remote_2", - "output_index": [0], + "output_index": [[0]], "io_type": "INT", "is_list": False, }