Files
aigc-home/docs/hel-892/batch180-exact-engine/initial-generated/protocol-matrix.json
T

291 lines
51 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[
{
"id": "input-link",
"path": "execution.py",
"lines": [
168,
195
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:get_input_data",
"condition": "is_link and not rawLink; execution_list/cache/output exists; output_index < len(outputs)",
"conditional_result": "从cached.outputs[output_index]取值;缺缓存/越上界标missing,不靠RETURN_TYPES裁剪缓存。",
"comparison_to_178": "链接局部分支与旧版相同;全函数因新增隐藏输入不同。",
"excerpt": " valid_inputs = class_def.INPUT_TYPES()\n if is_v3:\n valid_inputs, hidden, v3_data = _io.get_finalized_class_inputs(valid_inputs, inputs)\n input_data_all = {}\n missing_keys = {}\n for x in inputs:\n input_data = inputs[x]\n _, input_category, input_info = get_input_info(class_def, x, valid_inputs)\n def mark_missing():\n missing_keys[x] = True\n input_data_all[x] = (None,)\n if is_link(input_data) and (not input_info or not input_info.get(\"rawLink\", False)):\n input_unique_id = input_data[0]\n output_index = input_data[1]\n if execution_list is None:\n mark_missing()\n continue # This might be a lazily-evaluated input\n cached = execution_list.get_cache(input_unique_id, unique_id)\n if cached is None or cached.outputs is None:\n mark_missing()\n continue\n if output_index >= len(cached.outputs):\n mark_missing()\n continue\n obj = cached.outputs[output_index]\n input_data_all[x] = obj\n elif input_category is not None or (is_v3 and class_def.ACCEPT_ALL_INPUTS):\n input_data_all[x] = [input_data]\n",
"excerpt_sha256": "1e53926ba8012fd4a103f97aae01fa9252a231028714efa7822cf7caca1bff2a",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "dispatch",
"path": "execution.py",
"lines": [
252,
328
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:_async_map_node_over_list",
"condition": "INPUT_IS_LIST or per-item slice; blocker / V1 / V3 / coroutine dispatch",
"conditional_result": "V1直接getattr(obj,func)(**inputs);重复最后输入;V3使用clone/嵌套输入;异步可返Task。",
"comparison_to_178": "V1局部调用相同;V3 build_nested_inputs新增input_is_list参数,全函数不同。",
"excerpt": "async def _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, func, allow_interrupt=False, execution_block_cb=None, pre_execute_cb=None, v3_data=None):\n # check if node wants the lists\n input_is_list = getattr(obj, \"INPUT_IS_LIST\", False)\n\n if len(input_data_all) == 0:\n max_len_input = 0\n else:\n max_len_input = max(len(x) for x in input_data_all.values())\n\n # get a slice of inputs, repeat last input when list isn't long enough\n def slice_dict(d, i):\n return {k: v[i if len(v) > i else -1] for k, v in d.items()}\n\n results = []\n async def process_inputs(inputs, index=None, input_is_list=False):\n if allow_interrupt:\n nodes.before_node_execution()\n execution_block = None\n for k, v in inputs.items():\n if input_is_list:\n for e in v:\n if isinstance(e, ExecutionBlocker):\n v = e\n break\n if isinstance(v, ExecutionBlocker):\n execution_block = execution_block_cb(v) if execution_block_cb else v\n break\n if execution_block is None:\n if pre_execute_cb is not None and index is not None:\n pre_execute_cb(index)\n # V3\n if isinstance(obj, _ComfyNodeInternal) or (is_class(obj) and issubclass(obj, _ComfyNodeInternal)):\n # if is just a class, then assign no state, just create clone\n if is_class(obj):\n type_obj = obj\n obj.VALIDATE_CLASS()\n class_clone = obj.PREPARE_CLASS_CLONE(v3_data)\n # otherwise, use class instance to populate/reuse some fields\n else:\n type_obj = type(obj)\n type_obj.VALIDATE_CLASS()\n class_clone = type_obj.PREPARE_CLASS_CLONE(v3_data)\n f = make_locked_method_func(type_obj, func, class_clone)\n # in case of dynamic inputs, restructure inputs to expected nested dict\n if v3_data is not None:\n inputs = _io.build_nested_inputs(inputs, v3_data, input_is_list=input_is_list)\n # V1\n else:\n f = getattr(obj, func)\n if inspect.iscoroutinefunction(f):\n async def async_wrapper(f, prompt_id, unique_id, list_index, args):\n with CurrentNodeContext(prompt_id, unique_id, list_index):\n return await f(**args)\n task = asyncio.create_task(async_wrapper(f, prompt_id, unique_id, index, args=inputs))\n # Give the task a chance to execute without yielding\n await asyncio.sleep(0)\n if task.done():\n result = task.result()\n results.append(result)\n else:\n results.append(task)\n else:\n with CurrentNodeContext(prompt_id, unique_id, index):\n result = f(**inputs)\n results.append(result)\n else:\n results.append(execution_block)\n\n if input_is_list:\n await process_inputs(input_data_all, 0, input_is_list=input_is_list)\n elif max_len_input == 0:\n await process_inputs({})\n else:\n for i in range(max_len_input):\n input_dict = slice_dict(input_data_all, i)\n await process_inputs(input_dict, i)\n return results\n",
"excerpt_sha256": "efa025ecdf0ae9200ff92bfb61dfce570ed83234fe45f20706382e6d96f4529c",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "result-normal",
"path": "execution.py",
"lines": [
365,
383
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:get_output_from_returns",
"condition": "dict with result, no expand, result not ExecutionBlocker",
"conditional_result": "ui单独收集;整项result加入results,不按RETURN_TYPES长度截断。",
"comparison_to_178": "所属get_output_from_returns在两旧版均AST相同。",
"excerpt": " for i in range(len(return_values)):\n r = return_values[i]\n if isinstance(r, dict):\n if 'ui' in r:\n uis.append(r['ui'])\n if 'expand' in r:\n # Perform an expansion, but do not append results\n has_subgraph = True\n new_graph = r['expand']\n result = r.get(\"result\", None)\n if isinstance(result, ExecutionBlocker):\n result = tuple([result] * len(obj.RETURN_TYPES))\n subgraph_results.append((new_graph, result))\n elif 'result' in r:\n result = r.get(\"result\", None)\n if isinstance(result, ExecutionBlocker):\n result = tuple([result] * len(obj.RETURN_TYPES))\n results.append(result)\n subgraph_results.append((None, result))\n",
"excerpt_sha256": "26c45a6a0dc3e19a1de53600ebe998f483a464154a12252b622d6a909c91bcca",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "merge-default",
"path": "execution.py",
"lines": [
331,
350
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:merge_result_data",
"condition": "results nonempty; no OUTPUT_IS_LIST; all batches have compatible indices",
"conditional_result": "按首项实际len建立False标记,再逐出口收集;AIO传出的二项result在此条件保留二项。",
"comparison_to_178": "两旧版该函数AST相同;不证明继承/依赖/实跑等价。",
"excerpt": "def merge_result_data(results, obj):\n # check which outputs need concatenating\n output = []\n output_is_list = [False] * len(results[0])\n if hasattr(obj, \"OUTPUT_IS_LIST\"):\n output_is_list = obj.OUTPUT_IS_LIST\n\n # merge node execution results\n for i, is_list in zip(range(len(results[0])), output_is_list):\n if is_list:\n value = []\n for o in results:\n if isinstance(o[i], ExecutionBlocker):\n value.append(o[i])\n else:\n value.extend(o[i])\n output.append(value)\n else:\n output.append([o[i] for o in results])\n return output\n",
"excerpt_sha256": "3d1847a677810515fc1a45b1930e7dc701b8b03acf4643680877cae7139fa112",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "merge-explicit",
"path": "execution.py",
"lines": [
334,
349
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:merge_result_data",
"condition": "OUTPUT_IS_LIST present or heterogeneous result lengths",
"conditional_result": "zip长度受显式标记限制,短标记可截断;True分支extend;后续缺索引可IndexError。",
"comparison_to_178": "两旧版AST相同;不能泛化为一定保留或一定拒绝。",
"excerpt": " output_is_list = [False] * len(results[0])\n if hasattr(obj, \"OUTPUT_IS_LIST\"):\n output_is_list = obj.OUTPUT_IS_LIST\n\n # merge node execution results\n for i, is_list in zip(range(len(results[0])), output_is_list):\n if is_list:\n value = []\n for o in results:\n if isinstance(o[i], ExecutionBlocker):\n value.append(o[i])\n else:\n value.extend(o[i])\n output.append(value)\n else:\n output.append([o[i] for o in results])\n",
"excerpt_sha256": "2cc631a14b4c94373db0c58f83aba70cad0833a2e9a40deaaa91e3857a80cfac",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "ui",
"path": "execution.py",
"lines": [
416,
423
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:get_output_from_returns",
"condition": "one or more ui dictionaries",
"conditional_result": "按第一个ui键汇集x[k];后项缺键可抛错,存在ui不等于生成成功。",
"comparison_to_178": "两旧版AST相同。",
"excerpt": " ui = dict()\n # TODO: Think there's an existing bug here\n # If we're performing a subgraph expansion, we probably shouldn't be returning UI values yet.\n # They'll get cached without the completed subgraphs. It's an edge case and I'm not aware of\n # any nodes that use both subgraph expansion and custom UI outputs, but might be a problem in the future.\n if len(uis) > 0:\n ui = {k: [y for x in uis for y in x[k]] for k in uis[0].keys()}\n return output, ui, has_subgraph\n",
"excerpt_sha256": "3da1ae7feaf10776f772404786d91e81af4c44ce9cecf7beb7d3242fcabffd1c",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "blocker-expand-v3",
"path": "execution.py",
"lines": [
370,
415
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:get_output_from_returns",
"condition": "expand key / _NodeOutputInternal / ExecutionBlocker",
"conditional_result": "扩图先收subgraph_results;blocker按RETURN_TYPES长度造占位;V3独立分支,不能套普通dict结论。",
"comparison_to_178": "此拆分函数两旧版AST相同;准确8010 SDK/缓存等依赖文本未取得。",
"excerpt": " if 'expand' in r:\n # Perform an expansion, but do not append results\n has_subgraph = True\n new_graph = r['expand']\n result = r.get(\"result\", None)\n if isinstance(result, ExecutionBlocker):\n result = tuple([result] * len(obj.RETURN_TYPES))\n subgraph_results.append((new_graph, result))\n elif 'result' in r:\n result = r.get(\"result\", None)\n if isinstance(result, ExecutionBlocker):\n result = tuple([result] * len(obj.RETURN_TYPES))\n results.append(result)\n subgraph_results.append((None, result))\n elif isinstance(r, _NodeOutputInternal):\n # V3\n if r.ui is not None:\n if isinstance(r.ui, dict):\n uis.append(r.ui)\n else:\n uis.append(r.ui.as_dict())\n if r.expand is not None:\n has_subgraph = True\n new_graph = r.expand\n result = r.result\n if r.block_execution is not None:\n result = tuple([ExecutionBlocker(r.block_execution)] * len(obj.RETURN_TYPES))\n subgraph_results.append((new_graph, result))\n elif r.result is not None:\n result = r.result\n if r.block_execution is not None:\n result = tuple([ExecutionBlocker(r.block_execution)] * len(obj.RETURN_TYPES))\n results.append(result)\n subgraph_results.append((None, result))\n else:\n if isinstance(r, ExecutionBlocker):\n r = tuple([r] * len(obj.RETURN_TYPES))\n results.append(r)\n subgraph_results.append((None, r))\n\n if has_subgraph:\n output = subgraph_results\n elif len(results) > 0:\n output = merge_result_data(results, obj)\n else:\n output = []\n",
"excerpt_sha256": "a48d9f72036d59f9d0f928e82ce78aeeedf8ece060dce69310aff914e2a8b8ca",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "pending",
"path": "execution.py",
"lines": [
352,
358
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:get_output_data",
"condition": "any unfinished asyncio.Task",
"conditional_result": "先返回待处理结果;无待处理Task才调用拆分函数。",
"comparison_to_178": "两旧版该函数AST相同。",
"excerpt": "async def get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=None, pre_execute_cb=None, v3_data=None):\n return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)\n has_pending_task = any(isinstance(r, asyncio.Task) and not r.done() for r in return_values)\n if has_pending_task:\n return return_values, {}, False, has_pending_task\n output, ui, has_subgraph = get_output_from_returns(return_values, obj)\n return output, ui, has_subgraph, False\n",
"excerpt_sha256": "fc853c9de3a9c2c692e61497fbe8e8bb1e1db94feead00fb43acfe836533524e",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "async-resume",
"path": "execution.py",
"lines": [
455,
491
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:execute",
"condition": "pending_async_nodes or pending_subgraph_results",
"conditional_result": "Task.result异常重新抛;子图取缓存并merge;继续走后置UI/缓存,不能视作普通同步返回。",
"comparison_to_178": "execute全函数不同;只能引用本commit这些调用,不继承旧版整体成功/失败结论。",
"excerpt": " try:\n if unique_id in pending_async_nodes:\n results = []\n for r in pending_async_nodes[unique_id]:\n if isinstance(r, asyncio.Task):\n try:\n results.append(r.result())\n except Exception as ex:\n # An async task failed - propagate the exception up\n del pending_async_nodes[unique_id]\n raise ex\n else:\n results.append(r)\n del pending_async_nodes[unique_id]\n output_data, output_ui, has_subgraph = get_output_from_returns(results, class_def)\n elif unique_id in pending_subgraph_results:\n cached_results = pending_subgraph_results[unique_id]\n resolved_outputs = []\n for is_subgraph, result in cached_results:\n if not is_subgraph:\n resolved_outputs.append(result)\n else:\n resolved_output = []\n for r in result:\n if is_link(r):\n source_node, source_output = r[0], r[1]\n node_cached = execution_list.get_cache(source_node, unique_id)\n for o in node_cached.outputs[source_output]:\n resolved_output.append(o)\n\n else:\n resolved_output.append(r)\n resolved_outputs.append(tuple(resolved_output))\n output_data = merge_result_data(resolved_outputs, class_def)\n output_ui = []\n del pending_subgraph_results[unique_id]\n has_subgraph = False\n",
"excerpt_sha256": "a555f0e19e66dcad0ba24e91aa902a7ed4c68c83fdd3563933086e4d8c9eaa18",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "call-cleanup",
"path": "execution.py",
"lines": [
499,
572
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:execute",
"condition": "cache miss; instantiate object; lazy checks; get_output_data try/finally",
"conditional_result": "懒输入可PENDING;finally内aimdo条件清理也可能影响完成,未取得相关实现。",
"comparison_to_178": "execute不同,新增/变化外围须独立保留条件。",
"excerpt": " obj = await caches.objects.get(unique_id)\n if obj is None:\n obj = class_def()\n await caches.objects.set(unique_id, obj)\n\n if issubclass(class_def, _ComfyNodeInternal):\n lazy_status_present = first_real_override(class_def, \"check_lazy_status\") is not None\n else:\n lazy_status_present = getattr(obj, \"check_lazy_status\", None) is not None\n if lazy_status_present:\n # for check_lazy_status, the returned data should include the original key of the input\n v3_data_lazy = v3_data.copy()\n v3_data_lazy[\"create_dynamic_tuple\"] = True\n required_inputs = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, \"check_lazy_status\", allow_interrupt=True, v3_data=v3_data_lazy)\n required_inputs = await resolve_map_node_over_list_results(required_inputs)\n required_inputs = set(sum([r for r in required_inputs if isinstance(r,list)], []))\n required_inputs = [x for x in required_inputs if isinstance(x,str) and (\n x not in input_data_all or x in missing_keys\n )]\n if len(required_inputs) > 0:\n for i in required_inputs:\n execution_list.make_input_strong_link(unique_id, i)\n return (ExecutionResult.PENDING, None, None)\n if execution_list.is_staged_node_blocked():\n return (ExecutionResult.PENDING, None, None)\n\n def execution_block_cb(block):\n if block.message is not None:\n mes = {\n \"prompt_id\": prompt_id,\n \"node_id\": unique_id,\n \"node_type\": class_type,\n \"executed\": list(executed),\n\n \"exception_message\": f\"Execution Blocked: {block.message}\",\n \"exception_type\": \"ExecutionBlocked\",\n \"traceback\": [],\n \"current_inputs\": [],\n \"current_outputs\": [],\n }\n server.send_sync(\"execution_error\", mes, server.client_id)\n return ExecutionBlocker(None)\n else:\n return block\n def pre_execute_cb(call_index):\n # TODO - How to handle this with async functions without contextvars (which requires Python 3.12)?\n GraphBuilder.set_default_prefix(unique_id, call_index, 0)\n\n try:\n output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)\n finally:\n if comfy.memory_management.aimdo_enabled:\n if get_console_log_level(args.verbose) == \"DEBUG\":\n comfy_aimdo.control.analyze()\n comfy.model_prefetch.cleanup_prefetch_queues()\n comfy.model_management.reset_cast_buffers()\n comfy_aimdo.model_vbar.vbars_reset_watermark_limits()\n\n if has_pending_tasks:\n pending_async_nodes[unique_id] = output_data\n unblock = execution_list.add_external_block(unique_id)\n async def await_completion():\n tasks = [x for x in output_data if isinstance(x, asyncio.Task)]\n await asyncio.gather(*tasks, return_exceptions=True)\n unblock()\n asyncio.create_task(await_completion())\n return (ExecutionResult.PENDING, None, None)\n cache_ui_value = ui_outputs.get(unique_id)\n if len(output_ui) > 0:\n output_ui = enrich_output_with_media_metadata(output_ui)\n meta = {\n \"node_id\": unique_id,\n \"display_node\": display_node_id,\n \"parent_node\": parent_node_id,\n",
"excerpt_sha256": "599c3aca55c3512b4adcd9c4741a574c9b300fa4a8505ccbf5a4f0d3e6f4f09e",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "ui-enrich-cache",
"path": "execution.py",
"lines": [
573,
629
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:execute",
"condition": "nonempty output_ui; optional client; has_subgraph",
"conditional_result": "先enrich/register并可能发executed,再子图PENDING或CacheEntry(outputs=output_data)缓存。",
"comparison_to_178": "execute不同;UI/媒体/asset和cache provider行为不继承旧版。",
"excerpt": " \"real_node_id\": real_node_id,\n }\n enriched_output_ui = register_executed_outputs(output_ui, prompt_id, asset_manager)\n ui_outputs[unique_id] = {\"meta\": meta, \"output\": enriched_output_ui}\n cache_ui_value = {\"meta\": meta, \"output\": output_ui}\n if server.client_id is not None:\n server.send_sync(\"executed\", { \"node\": unique_id, \"display_node\": display_node_id, \"output\": enriched_output_ui, \"prompt_id\": prompt_id }, server.client_id)\n if has_subgraph:\n cached_outputs = []\n new_node_ids = []\n new_output_ids = []\n new_output_links = []\n for i in range(len(output_data)):\n new_graph, node_outputs = output_data[i]\n if new_graph is None:\n cached_outputs.append((False, node_outputs))\n else:\n for node_id, node_info in new_graph.items():\n new_node_ids.append(node_id)\n display_id = node_info.get(\"override_display_id\", unique_id)\n dynprompt.add_ephemeral_node(node_id, node_info, unique_id, display_id)\n # Figure out if the newly created node is an output node\n class_type = node_info[\"class_type\"]\n class_def = nodes.NODE_CLASS_MAPPINGS[class_type]\n if hasattr(class_def, 'OUTPUT_NODE') and class_def.OUTPUT_NODE == True:\n new_output_ids.append(node_id)\n for i in range(len(node_outputs)):\n if is_link(node_outputs[i]):\n from_node_id, from_socket = node_outputs[i][0], node_outputs[i][1]\n new_output_links.append((from_node_id, from_socket))\n cached_outputs.append((True, node_outputs))\n new_node_ids = set(new_node_ids)\n for cache in caches.all:\n subcache = await cache.ensure_subcache_for(unique_id, new_node_ids)\n subcache.clean_unused()\n for node_id in new_output_ids:\n execution_list.add_node(node_id)\n execution_list.cache_link(node_id, unique_id)\n for link in new_output_links:\n execution_list.add_strong_link(link[0], link[1], unique_id)\n pending_subgraph_results[unique_id] = cached_outputs\n return (ExecutionResult.PENDING, None, None)\n\n cache_entry = CacheEntry(ui=cache_ui_value, outputs=output_data)\n execution_list.cache_update(unique_id, cache_entry)\n await caches.outputs.set(unique_id, cache_entry)\n\n except comfy.model_management.InterruptProcessingException as iex:\n logging.info(\"Processing interrupted\")\n\n # skip formatting inputs/outputs\n error_details = {\n \"node_id\": real_node_id,\n }\n\n return (ExecutionResult.FAILURE, error_details, iex)\n except Exception as ex:\n",
"excerpt_sha256": "7d176bd29363c9b28ec72fb8db586c139d1737af2c4089cfbf3617d8b91208cf",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "exceptions",
"path": "execution.py",
"lines": [
631,
663
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:execute",
"condition": "InterruptProcessingException or Exception inside execute try",
"conditional_result": "返回FAILURE与错误详情;发生在缓存命中早返/try之外的异常不由这层概括。",
"comparison_to_178": "execute不同;仅本地try作用域可核,不作全宿主异常保证。",
"excerpt": " exception_type = full_type_name(typ)\n input_data_formatted = {}\n if input_data_all is not None:\n input_data_formatted = {}\n for name, inputs in input_data_all.items():\n input_data_formatted[name] = [format_value(x) for x in inputs]\n\n logging.error(f\"!!! Exception during processing !!! {ex}\")\n logging.error(traceback.format_exc())\n tips = \"\"\n\n if comfy.model_management.is_oom(ex):\n tips = \"This error means you ran out of memory on your GPU.\\n\\nTIPS: If the workflow worked before you might have accidentally set the batch_size to a large number.\"\n logging.info(\"Memory summary:\\n{}\".format(comfy.model_management.debug_memory_summary()))\n logging.error(\"Got an OOM, unloading all loaded models.\")\n comfy.model_management.unload_all_models()\n elif isinstance(ex, RuntimeError) and (\"mat1 and mat2 shapes\" in str(ex)) and \"Sampler\" in class_type:\n tips = \"\\n\\nTIPS: If you have any \\\"Load CLIP\\\" or \\\"*CLIP Loader\\\" nodes in your workflow connected to this sampler node make sure the correct file(s) and type is selected.\"\n\n error_details = {\n \"node_id\": real_node_id,\n \"exception_message\": \"{}\\n{}\".format(ex, tips),\n \"exception_type\": exception_type,\n \"traceback\": traceback.format_tb(tb),\n \"current_inputs\": input_data_formatted\n }\n\n return (ExecutionResult.FAILURE, error_details, ex)\n\n get_progress_state().finish_progress(unique_id)\n executed.add(unique_id)\n\n return (ExecutionResult.SUCCESS, None, None)\n",
"excerpt_sha256": "54a55f6c9729612413c6e8b5d216d6abdc4450cdefcba649de9f4bf1761e7841",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "history-partial",
"path": "execution.py",
"lines": [
784,
843
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:PromptExecutor.execute",
"condition": "PromptExecutor loop; FAILURE/PENDING/SUCCESS",
"conditional_result": "FAILURE处理后break;无break才execution_success;history收已有ui,局部UI不证明整体成功。",
"comparison_to_178": "178原branch索引未提供该完整方法;本次从四文本取得,不冒称旧方法相同。",
"excerpt": " while not execution_list.is_empty():\n node_id, error, ex = await execution_list.stage_node_execution()\n if error is not None:\n self.handle_execution_error(prompt_id, dynamic_prompt.original_prompt, current_outputs, executed, error, ex)\n break\n\n assert node_id is not None, \"Node ID should not be None at this point\"\n result, error, ex = await execute(self.server, dynamic_prompt, self.caches, node_id, extra_data, executed, prompt_id, execution_list, pending_subgraph_results, pending_async_nodes, ui_node_outputs, self.asset_manager)\n self.success = result != ExecutionResult.FAILURE\n if result == ExecutionResult.FAILURE:\n self.handle_execution_error(prompt_id, dynamic_prompt.original_prompt, current_outputs, executed, error, ex)\n break\n elif result == ExecutionResult.PENDING:\n execution_list.unstage_node_execution()\n else: # result == ExecutionResult.SUCCESS:\n execution_list.complete_node_execution()\n\n if self.cache_type == CacheType.RAM_PRESSURE:\n ram_release_callback(ram_inactive_headroom)\n ram_shortfall = ram_headroom - comfy.system_memory.virtual_memory_available()\n if ram_shortfall > 0:\n freed = ram_release_callback(ram_headroom, free_active=True, min_entry_size=RAM_CACHE_LARGE_INTERMEDIATE)\n ram_shortfall -= freed\n if comfy.model_management.should_free_pins_for_ram_pressure(ram_shortfall):\n freed = comfy.model_management.free_pins(ram_shortfall + 512 * (1024 ** 2))\n if freed < ram_shortfall:\n if freed > 64 * (1024 ** 2):\n # AIMDO MEM_DECOMMIT can outrun psutil.available catching up.\n time.sleep(0.05)\n ram_release_callback(ram_headroom, free_active=True)\n else:\n # Only execute when the while-loop ends without break\n # Send cached UI for intermediate output nodes that weren't executed\n for node_id in dynamic_prompt.all_node_ids():\n if node_id in executed:\n continue\n if not _is_intermediate_output(dynamic_prompt, node_id):\n continue\n cached = await self.caches.outputs.get(node_id)\n if cached is not None:\n display_node_id = dynamic_prompt.get_display_node_id(node_id)\n emit_cached_output(self.server, node_id, display_node_id, cached, prompt_id, ui_node_outputs, self.asset_manager)\n self.add_message(\"execution_success\", { \"prompt_id\": prompt_id }, broadcast=False)\n\n ui_outputs = {}\n meta_outputs = {}\n for node_id, ui_info in ui_node_outputs.items():\n ui_outputs[node_id] = ui_info[\"output\"]\n meta_outputs[node_id] = ui_info[\"meta\"]\n self.history_result = {\n \"outputs\": ui_outputs,\n \"meta\": meta_outputs,\n }\n self.server.last_node_id = None\n if comfy.model_management.DISABLE_SMART_MEMORY:\n comfy.model_management.unload_all_models()\n finally:\n if self.cache_type == CacheType.RAM_PRESSURE:\n detail(\"RAM cache evictions: prompt=%s active=%s full=%s\", prompt_id, self.caches.outputs.active_evictions, self.caches.outputs.full_evictions)\n comfy.memory_management.set_ram_cache_release_state(None, 0)\n",
"excerpt_sha256": "7c0fdc13b5e2f982999601333d877b1550951e43a82b2588a8c62bcc0538cc93",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "declared-index",
"path": "execution.py",
"lines": [
927,
991
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:validate_inputs",
"condition": "linked val is length-2 list; upstream registered class",
"conditional_result": "先r=RETURN_TYPES再r[val[1]];AIO仅声明IMAGE,索引1不能凭多返回合法化;0仍需其它校验。",
"comparison_to_178": "声明索引局部赋值两旧版相同;递归visiting/cycle及全validate_inputs不同。",
"excerpt": " val = inputs[x]\n info = (input_type, extra_info)\n if isinstance(val, list):\n if len(val) != 2:\n error = {\n \"type\": \"bad_linked_input\",\n \"message\": \"Bad linked input, must be a length-2 list of [node_id, slot_index]\",\n \"details\": f\"{x}\",\n \"extra_info\": {\n \"input_name\": x,\n \"input_config\": info,\n \"received_value\": val\n }\n }\n errors.append(error)\n continue\n\n o_id = val[0]\n o_class_type = prompt[o_id]['class_type']\n r = nodes.NODE_CLASS_MAPPINGS[o_class_type].RETURN_TYPES\n received_type = r[val[1]]\n received_types[x] = received_type\n if 'input_types' not in validate_function_inputs and not validate_node_input(received_type, input_type):\n details = f\"{x}, received_type({received_type}) mismatch input_type({input_type})\"\n error = {\n \"type\": \"return_type_mismatch\",\n \"message\": \"Return type mismatch between linked nodes\",\n \"details\": details,\n \"extra_info\": {\n \"input_name\": x,\n \"input_config\": info,\n \"received_type\": received_type,\n \"linked_node\": val\n }\n }\n errors.append(error)\n continue\n try:\n visiting.append(unique_id)\n try:\n r = await validate_inputs(prompt_id, prompt, o_id, validated, visiting)\n finally:\n visiting.pop()\n if r[0] is False:\n # `r` will be set in `validated[o_id]` already\n valid = False\n continue\n except Exception as ex:\n typ, _, tb = sys.exc_info()\n valid = False\n exception_type = full_type_name(typ)\n reasons = [{\n \"type\": \"exception_during_inner_validation\",\n \"message\": \"Exception when validating inner node\",\n \"details\": str(ex),\n \"extra_info\": {\n \"input_name\": x,\n \"input_config\": info,\n \"exception_message\": str(ex),\n \"exception_type\": exception_type,\n \"traceback\": traceback.format_tb(tb),\n \"linked_node\": val\n }\n }]\n validated[o_id] = (False, reasons, o_id)\n",
"excerpt_sha256": "9039841cf84aeb8ada592f414f4bb4a70be0fa0d3391b806ae4fc9c695f11faa",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "cycle-schema-custom",
"path": "execution.py",
"lines": [
849,
903
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:validate_inputs",
"condition": "cycle / V3 finalized inputs / custom validator",
"conditional_result": "新增visiting循环检测;V3模式和INPUT_TYPES调用是运行时条件,本批仅文本不调用。",
"comparison_to_178": "validate_inputs不同,不能把旧校验错误集合当8010全集。",
"excerpt": " if visiting is None:\n visiting = []\n\n unique_id = item\n if unique_id in validated:\n return validated[unique_id]\n\n if unique_id in visiting:\n cycle_path_nodes = visiting[visiting.index(unique_id):] + [unique_id]\n cycle_nodes = list(dict.fromkeys(cycle_path_nodes))\n cycle_path = \" -> \".join(f\"{node_id} ({prompt[node_id]['class_type']})\" for node_id in cycle_path_nodes)\n for node_id in cycle_nodes:\n validated[node_id] = (False, [{\n \"type\": \"dependency_cycle\",\n \"message\": \"Dependency cycle detected\",\n \"details\": cycle_path,\n \"extra_info\": {\n \"node_id\": node_id,\n \"cycle_nodes\": cycle_nodes,\n }\n }], node_id)\n return validated[unique_id]\n\n inputs = prompt[unique_id]['inputs']\n class_type = prompt[unique_id]['class_type']\n obj_class = nodes.NODE_CLASS_MAPPINGS[class_type]\n\n errors = []\n valid = True\n\n v3_data = None\n validate_function_inputs = []\n validate_has_kwargs = False\n if issubclass(obj_class, _ComfyNodeInternal):\n obj_class: _io._ComfyNodeBaseInternal\n class_inputs = obj_class.INPUT_TYPES()\n try:\n class_inputs, _, v3_data = _io.get_finalized_class_inputs(class_inputs, inputs)\n except _io.DynamicInputError as ex:\n errors.append({\n \"type\": \"invalid_dynamic_input\",\n \"message\": \"Invalid dynamic input\",\n \"details\": str(ex),\n \"extra_info\": {\"input_name\": ex.input_name},\n })\n validated[unique_id] = (False, errors, unique_id)\n return validated[unique_id]\n validate_function_name = \"validate_inputs\"\n validate_function = first_real_override(obj_class, validate_function_name)\n else:\n class_inputs = obj_class.INPUT_TYPES()\n validate_function_name = \"VALIDATE_INPUTS\"\n validate_function = getattr(obj_class, validate_function_name, None)\n if validate_function is not None:\n argspec = inspect.getfullargspec(validate_function)\n",
"excerpt_sha256": "7fc2dca4d6ea4690d898f5e4244569e0b5f9ee0a65951f84764c837118c7ae81",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "partial-validation",
"path": "execution.py",
"lines": [
1208,
1300
],
"source_sha256": "3ce8f730e5a64c25c596351b4173edcf5a6948e8486d3531bd7d319f1eb114af",
"evidence": "execution.py:validate_prompt",
"condition": "per-output validation exception; validate_loops; good_outputs",
"conditional_result": "外层捕获exception_during_validation;循环校验可再移除输出;全无good输出才失败,否则部分接受。",
"comparison_to_178": "validate_prompt不同:新增loop/cycle阶段;局部成功不等于case01全图成功。",
"excerpt": " for o in outputs:\n valid = False\n reasons = []\n try:\n m = await validate_inputs(prompt_id, prompt, o, validated)\n valid = m[0]\n reasons = m[1]\n except Exception as ex:\n typ, _, tb = sys.exc_info()\n valid = False\n exception_type = full_type_name(typ)\n reasons = [{\n \"type\": \"exception_during_validation\",\n \"message\": \"Exception when validating node\",\n \"details\": str(ex),\n \"extra_info\": {\n \"exception_type\": exception_type,\n \"traceback\": traceback.format_tb(tb)\n }\n }]\n validated[o] = (False, reasons, o)\n\n if valid is True:\n good_outputs.add(o)\n else:\n logging.error(f\"Failed to validate prompt for output {o}:\")\n if len(reasons) > 0:\n logging.error(\"* (prompt):\")\n for reason in reasons:\n logging.error(f\" - {reason['message']}: {reason['details']}\")\n errors += [(o, reasons)]\n for node_id, result in validated.items():\n valid = result[0]\n reasons = result[1]\n # If a node upstream has errors, the nodes downstream will also\n # be reported as invalid, but there will be no errors attached.\n # So don't return those nodes as having errors in the response.\n if valid is not True and len(reasons) > 0:\n if node_id not in node_errors:\n class_type = prompt[node_id]['class_type']\n node_errors[node_id] = {\n \"errors\": reasons,\n \"dependent_outputs\": [],\n \"class_type\": class_type\n }\n logging.error(f\"* {class_type} {node_id}:\")\n for reason in reasons:\n logging.error(f\" - {reason['message']}: {reason['details']}\")\n node_errors[node_id][\"dependent_outputs\"].append(o)\n logging.error(\"Output will be ignored\")\n\n has_dependency_cycle = any(\n reason[\"type\"] == \"dependency_cycle\"\n for valid, reasons, _ in validated.values()\n for reason in reasons\n )\n if not has_dependency_cycle:\n try:\n validate_loops(prompt, outputs, validated, start_nodes, end_nodes)\n except LoopValidationError as ex:\n dependent_outputs = ex.error[\"extra_info\"][\"output_ids\"]\n for node_id in ex.error[\"extra_info\"][\"node_ids\"]:\n if node_id not in node_errors:\n node_errors[node_id] = {\n \"errors\": [],\n \"dependent_outputs\": [],\n \"class_type\": prompt[node_id][\"class_type\"],\n }\n node_errors[node_id][\"errors\"].append(ex.error)\n node_errors[node_id][\"dependent_outputs\"] = sorted(\n set(node_errors[node_id][\"dependent_outputs\"]).union(dependent_outputs)\n )\n for output_id in dependent_outputs:\n good_outputs.discard(output_id)\n errors.append((dependent_outputs[0], [ex.error]))\n\n if len(good_outputs) == 0:\n errors_list = []\n for o, errors in errors:\n for error in errors:\n errors_list.append(f\"{error['message']}: {error['details']}\")\n errors_list = \"\\n\".join(errors_list)\n\n error = {\n \"type\": \"prompt_outputs_failed_validation\",\n \"message\": \"Prompt outputs failed validation\",\n \"details\": errors_list,\n \"extra_info\": {}\n }\n\n return (False, error, list(good_outputs), node_errors)\n\n return (True, None, list(good_outputs), node_errors)\n",
"excerpt_sha256": "a62fa2a332ad6ed271f3d0c75fe5cdeee999f15f59ecfc399f0c3acfd78e6c86",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "graph-cache",
"path": "comfy_execution/graph.py",
"lines": [
230,
264
],
"source_sha256": "b78c69dda0718e2c6a44fe54d822470632ff638e467ee8448e2d3fab67dbbf0a",
"evidence": "comfy_execution/graph.py:ExecutionList.cache_update",
"condition": "cache listeners and optional output_link_callback",
"conditional_result": "get_cache触碰写回set_local;cache_update向订阅者传播并调用可选callback(value.outputs[socket])。",
"comparison_to_178": "逐函数差异见comparison;缓存callback实现不在四份文本内。",
"excerpt": " def is_cached(self, node_id):\n return self.output_cache.get_local(node_id) is not None\n\n def cache_link(self, from_node_id, to_node_id, from_socket=None):\n if to_node_id not in self.execution_cache:\n self.execution_cache[to_node_id] = {}\n value = self.output_cache.get_local(from_node_id)\n self.execution_cache[to_node_id][from_node_id] = value\n if from_node_id not in self.execution_cache_listeners:\n self.execution_cache_listeners[from_node_id] = set()\n self.execution_cache_listeners[from_node_id].add((to_node_id, from_socket))\n if value is not None and from_socket is not None and self.output_link_callback is not None:\n self.output_link_callback(value.outputs[from_socket])\n\n def get_cache(self, from_node_id, to_node_id):\n if to_node_id not in self.execution_cache:\n return None\n value = self.execution_cache[to_node_id].get(from_node_id)\n if value is None:\n return None\n #Write back to the main cache on touch.\n self.output_cache.set_local(from_node_id, value)\n return value\n\n def cache_update(self, node_id, value):\n if node_id in self.execution_cache_listeners:\n for to_node_id, from_socket in self.execution_cache_listeners[node_id]:\n if to_node_id in self.execution_cache:\n self.execution_cache[to_node_id][node_id] = value\n if from_socket is not None and self.output_link_callback is not None:\n self.output_link_callback(value.outputs[from_socket])\n\n def add_strong_link(self, from_node_id, from_socket, to_node_id):\n super().add_strong_link(from_node_id, from_socket, to_node_id)\n self.cache_link(from_node_id, to_node_id, from_socket)\n",
"excerpt_sha256": "84a64eff781da44b04bda42cc3d4f77ba9c5804225f7d3b0ac65a85bbed5c4c6",
"evidence_kind": "static source text; engine tests 0"
},
{
"id": "type-validation",
"path": "comfy_execution/validation.py",
"lines": [
193,
247
],
"source_sha256": "0f8d37760f3c0e05836e7ade85f9b12fa1d3ecdfe710dfe88b4682f8fdb7ba75",
"evidence": "comfy_execution/validation.py:validate_node_input",
"condition": "exact/Any/MatchType/Combo/type strings and strict flag",
"conditional_result": "相等立即True;其余引用IO类型并做集合判断,不能只靠IMAGE字面量覆盖所有自定义类型。",
"comparison_to_178": "逐函数AST比较见comparison;准确SDK IO定义未取得。",
"excerpt": "def validate_node_input(\n received_type: str, input_type: str, strict: bool = False\n) -> bool:\n \"\"\"\n received_type and input_type are both strings of the form \"T1,T2,...\".\n\n If strict is True, the input_type must contain the received_type.\n For example, if received_type is \"STRING\" and input_type is \"STRING,INT\",\n this will return True. But if received_type is \"STRING,INT\" and input_type is\n \"INT\", this will return False.\n\n If strict is False, the input_type must have overlap with the received_type.\n For example, if received_type is \"STRING,BOOLEAN\" and input_type is \"STRING,INT\",\n this will return True.\n\n Supports pre-union type extension behaviour of ``__ne__`` overrides.\n \"\"\"\n # If the types are exactly the same, we can return immediately\n # Use pre-union behaviour: inverse of `__ne__`\n # NOTE: this lets legacy '*' Any types work that override the __ne__ method of the str class.\n if not received_type != input_type:\n return True\n\n # If one of the types is '*', we can return True immediately; this is the 'Any' type.\n if received_type == IO.AnyType.io_type or input_type == IO.AnyType.io_type:\n return True\n\n # If the received type or input_type is a MatchType, we can return True immediately;\n # validation for this is handled by the frontend\n if received_type == IO.MatchType.io_type or input_type == IO.MatchType.io_type:\n return True\n\n # This accounts for some custom nodes that output lists of options as the type;\n # if we ever want to break them on purpose, this can be removed\n if isinstance(received_type, list) and input_type == IO.Combo.io_type:\n return True\n\n # Not equal, and not strings\n if not isinstance(received_type, str) or not isinstance(input_type, str):\n return False\n\n # Split the type strings into sets for comparison\n received_types = set(t.strip() for t in received_type.split(\",\"))\n input_types = set(t.strip() for t in input_type.split(\",\"))\n\n # If any of the types is '*', we can return True immediately; this is the 'Any' type.\n if IO.AnyType.io_type in received_types or IO.AnyType.io_type in input_types:\n return True\n\n if strict:\n # In strict mode, all received types must be in the input types\n return received_types.issubset(input_types)\n else:\n # In non-strict mode, there must be at least one type in common\n return len(received_types.intersection(input_types)) > 0\n",
"excerpt_sha256": "c2e2f4227620a410ccfd7971f26fcc013caa2116bc22fa6c5827ca004013b6ca",
"evidence_kind": "static source text; engine tests 0"
}
]