apply_specs cannot replay a replace_ops batch that wires an autogrow slot (dot guard in _slot_ref)

未关闭
#1,034 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
cli, testing

调研方向

Read _slot_ref in comfy_cli/workflow_ops.py and the regression test TestOpModel::test_replace_ops_batch_is_replayable_through_apply_specs in tests/comfy_cli/command/test_workflow_edit.py. The issue describes how dotted autogrow slot names become unresolved refs in apply_specs. Done means the test passes without xfail and the same replace_ops batch replays through both consumers.

由索引模型根据 Issue 内容生成。

描述

bug

Problem

apply_specs cannot replay any replace_ops batch that wires an autogrow slot. The whole batch is discarded with ValueError: input '1' not found on node <id>; inputs: ['images'].

replace_ops returns one array that is meant to replay through both consumers — apply_op (the op path) and apply_specs (the spec path). That is the "one artifact, both consumers" contract in docs/op-vocabulary-v1.md §8.8.

The spec-form connect refs are minted by _slot_ref (comfy_cli/workflow_ops.py, ~line 1151). It preferred the slot name, but refused any name containing a dot and fell back to $alias.<slot index>. Autogrow slots are named images.image0, images.image1, … so the dot guard fired on every one of them.

The index fallback cannot resolve on the spec path. apply_specs re-mints each node from the live catalog, so a freshly added BatchImagesNode has only the bare images input — there is no slot at index 1 for $batchimagesnode.1 to address. The connect raises, and apply_specs aborts the remainder, so nothing from the batch is applied.

The guard's stated reason was that _split_ref_slot partitions on the first dot and so would mis-resolve a dotted name. That is not what happens: an alias is re.sub(r"[^a-z0-9_]", "", class_type.lower()), which never contains a dot, so partitioning on the first dot yields the alias and hands back the entire remainder — dots included — as the slot name. $batchimagesnode.images.image0 splits correctly.

Repro

import copy
from comfy_cli import workflow_ops
# `new` = any workflow with a BatchImagesNode whose autogrow base has wired slots
# (images.image0 … images.image2); `g` = a Graph built from object_info.
old = {"nodes": [], "links": [], "last_node_id": 0, "last_link_id": 0}
batch = workflow_ops.replace_ops(old, new)
workflow_ops.apply_op(...)      # replays fine, all 3 slots wired
workflow_ops.apply_specs(copy.deepcopy(old), g, batch)
# ValueError: input '1' not found on node 3909371455067170; inputs: ['images'].
# No changes were applied — the batch was discarded.

A runnable version is TestOpModel::test_replace_ops_batch_is_replayable_through_apply_specs in tests/comfy_cli/command/test_workflow_edit.py.

Impact

Every caller that emits a replace_ops batch and replays it through the spec path loses the whole batch, not just the autogrow wiring — apply_specs discards on the first failing spec. That covers templates fetch --emit-ops, generate, and recipe replay, for any workflow using an autogrow node such as BatchImagesNode.

It was invisible until now because the only existing replace_ops test used a link-less workflow.

Expected

replace_ops mints a connect ref the spec path can resolve, so the same array replays through apply_op and apply_specs with the same wiring.

Fix

Drop the dot guard in _slot_ref so dotted autogrow names are emitted verbatim. Filed alongside https://github.com/Comfy-Org/comfy-cli/pull/848, which applies that one-line change and turns the test above from a strict xfail into a real passing regression pin.

Task Decomposition

Not decomposed: this is a one-line production change (removing a single condition in _slot_ref) plus the test that pins it, already implemented in #848. Complexity tier: trivial. No sub-tasks or dependencies. Acceptance: TestOpModel::test_replace_ops_batch_is_replayable_through_apply_specs passes without an xfail marker and fails on the parent commit.

主要语言
Python
星标
1k
派生
176
平均合并
1 天 11 小时
30 天内合并 PR
87

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Comfy-Org/comfy-cli 的其他 Issue

查看 Comfy-Org/comfy-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。