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

オープン
#1,034 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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時間
マージ済み PR(30日)
87

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Comfy-Org/comfy-cli のほかの issue

Comfy-Org/comfy-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。