Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ history.
`asset_upload_refused`; new codes `asset_upload_invalid`,
`asset_upload_failed` and `asset_upload_timeout` cover the other ways it
can end.

- `comfy knowledge resolve` suggests canonical model ids for an incomplete
family/version name such as `Qwen 2.1`. The command still fails with
`knowledge_unknown_model` and exit 1, but `error.details.candidate_ids` lists
Expand All @@ -60,9 +61,16 @@ history.

### Fixed

- `comfy assets library ls` reports a 401 or 403 as `cloud_unauthorized` even
when the server drops the connection partway through its error body, instead
of crashing with `IncompleteRead`.
- `comfy build push --dry-run` now runs the push's registry-pin check, so a
pin the builder cannot place fails the dry run with the push's own
`build_registry_pin_missing` error instead of passing it. A version the
registry has Flagged was the common case: the dry run passed, and the push
was refused only after the plan had been disclosed. The check asks the
builder's snapshot importer to place each public pack, a read that writes
nothing, and the dry run still uploads and saves nothing. A spec that pins
a public pack now needs sign-in for its dry run (`build_not_signed_in`
otherwise); a spec whose packs are all local still sends no request.

- A typed `comfy model download` with no `--relative-path` now saves into the
folder the running local ComfyUI scans for that model type, and says where.
On Comfy Desktop that is the shared library, not the install's `models/`.
Expand Down Expand Up @@ -112,6 +120,10 @@ history.
value. Saves with a real marker have one more value than sockets and still go
through the filter.

- `comfy assets library ls` reports a 401 or 403 as `cloud_unauthorized` even
when the server drops the connection partway through its error body, instead
of crashing with `IncompleteRead`.

## [1.24.0] - 2026-10-29

[Full notes](https://github.com/Comfy-Org/comfy-cli/releases/tag/v1.24.0) · 25 commits since v1.23.0.
Expand Down
83 changes: 58 additions & 25 deletions comfy_cli/command/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1879,6 +1879,37 @@ def _write_spec(renderer, path: Path, spec: dict) -> None:
raise typer.Exit(code=1) from error


def _require_public_pins(renderer, client, public_nodes: list[dict], spec_file: Path) -> None:
"""Ask the builder's importer to place every public pack, and refuse with
``build_registry_pin_missing`` naming each identity it could not place: a
registry version it does not publish (a Flagged one among them), or a
repository it cannot normalize.

The importer reads the snapshot and writes nothing, which is what lets
``push --dry-run`` make the same call and refuse the same way. A lookup that
itself fails exits through ``_builder_call`` rather than passing the pins."""
imported = _builder_call(
renderer,
lambda: client.resolve_snapshot(snapshot_from_definition({"customNodes": public_nodes})),
)
checked = (imported.get("definition") or {}).get("customNodes") or []
try:
missing = public_node_identities(public_nodes) - public_node_identities(
public_node_projection({"customNodes": checked})
)
except BuildSpecInvalidError as error:
renderer.error(code=error.code, message=str(error), details={"path": str(spec_file)})
raise typer.Exit(code=1) from error
if missing:
labels = sorted(f"{identity.kind}:{identity.value}@{identity.version or '-'}" for identity in missing)
renderer.error(
code="build_registry_pin_missing",
message="the builder could not resolve these custom node identities: " + ", ".join(labels),
hint="edit the spec to name a published registry version or normalized repository, or remove the node",
)
raise typer.Exit(code=1)


@app.command("push", help="Push the local comfy-build spec to the builder.")
@tracking.track_command("build")
def push_cmd(
Expand Down Expand Up @@ -1912,7 +1943,13 @@ def push_cmd(
help="With --release, cut the release even though the save warned about a model link.",
),
] = False,
dry_run: Annotated[bool, typer.Option("--dry-run", help="Compute uploads locally; send no HTTP requests.")] = False,
dry_run: Annotated[
bool,
typer.Option(
"--dry-run",
help="Compute uploads locally and check public custom node pins with the builder; upload and save nothing.",
),
] = False,
models_dir: Annotated[
str | None,
typer.Option("--models-dir", help="Models folder used to resolve model localPath values."),
Expand All @@ -1927,7 +1964,7 @@ def push_cmd(
if release and dry_run:
renderer.error(
code="build_missing_input",
message="--release cuts a release from a real push, and --dry-run sends nothing.",
message="--release cuts a release from a real push, and --dry-run saves nothing.",
hint="drop --dry-run to cut the release, or drop --release to preview the push",
details={"conflict": ["--release", "--dry-run"]},
)
Expand Down Expand Up @@ -2008,15 +2045,30 @@ def push_cmd(
if reported:
payload["skipped_symlinks"] = reported
if dry_run:
# The pin check is the one question a dry run asks the builder: it is a
# read, it costs nothing, and it is the refusal a push otherwise meets
# only after the plan was disclosed. A spec without a public pin asks
# nothing, so it needs no sign-in.
public_nodes = public_node_projection(preparation.definition)
if public_nodes:
_require_public_pins(renderer, _builder_client(renderer, builder_url), public_nodes, paths.spec_file)
# The envelope is the whole answer and prints nothing in pretty mode, so a
# person gets the real push's opening line and word that nothing moved.
# "Already held" is what the spec records; the builder, never asked,
# may hold more.
if renderer.is_pretty():
renderer.info(plan_line(len(uploads), payload["upload_bytes"], already_held_count(preparation)))
renderer.info(
"--dry-run: nothing was sent; the builder may already hold more of these than the spec records."
)
if public_nodes:
count = len(public_nodes)
renderer.info(f"The builder resolved {count} public custom node pin{'' if count == 1 else 's'}.")
renderer.info(
"--dry-run: nothing was uploaded or saved; the builder may already hold more of these "
"than the spec records."
)
else:
renderer.info(
"--dry-run: nothing was sent; the builder may already hold more of these than the spec records."
)
if _has_models(spec):
renderer.info(f"--dry-run reads no folder list from the builder, so {_FOLDER_CASE_UNCHECKED}.")
renderer.emit(payload, command="build push", changed=False)
Expand All @@ -2033,26 +2085,7 @@ def push_cmd(

public_nodes = public_node_projection(preparation.definition)
if public_nodes:
imported = _builder_call(
renderer,
lambda: client.resolve_snapshot(snapshot_from_definition({"customNodes": public_nodes})),
)
checked = (imported.get("definition") or {}).get("customNodes") or []
try:
missing = public_node_identities(public_nodes) - public_node_identities(
public_node_projection({"customNodes": checked})
)
except BuildSpecInvalidError as error:
renderer.error(code=error.code, message=str(error), details={"path": str(paths.spec_file)})
raise typer.Exit(code=1) from error
if missing:
labels = sorted(f"{identity.kind}:{identity.value}@{identity.version or '-'}" for identity in missing)
renderer.error(
code="build_registry_pin_missing",
message="the builder could not resolve these custom node identities: " + ", ".join(labels),
hint="edit the spec to name a published registry version or normalized repository, or remove the node",
)
raise typer.Exit(code=1)
_require_public_pins(renderer, client, public_nodes, paths.spec_file)

# Said before the first byte moves, and said even when nothing will: a
# multi-GB upload is otherwise silent until it ends, and "0 files" is
Expand Down
4 changes: 3 additions & 1 deletion comfy_cli/error_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,9 @@ class ErrorCode:
"build_registry_pin_missing",
"`comfy build push` sent its identity-keyed public-node subset to the builder's snapshot importer, "
"which could not vouch for one or more pins. Pushing anyway would save a definition that cannot "
"reconstruct every requested public node.",
"reconstruct every requested public node. `push --dry-run` makes the same read-only check and "
"refuses the same way, uploading and saving nothing. A version the registry has Flagged "
"is refused here too, though the message does not say so.",
"edit the spec to name a published registry version or normalized repository, or remove the node",
),
ErrorCode(
Expand Down
9 changes: 7 additions & 2 deletions comfy_cli/skills/comfy-build-failures/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ can take (a model's `sourceUri`, a node's `registryVersion` or `repository`), fi
- `resolves to a duplicate node directory` — two entries claim one folder, so one
of them goes.
- `build_registry_pin_missing` — the builder could not place a public pack.
The message names each identity; correct the `registryVersion` against a
registry search, or remove the pack.
`push --dry-run` refuses the same way, before anything is uploaded or saved.
The message names each identity but not why. A version the registry has
Flagged lands here: check its `status` at
`https://api.comfy.org/nodes/<id>/versions`, and pin a version that is not
`NodeVersionStatusFlagged`, or the pack's `repository` and a commit `gitRef`.
Otherwise correct the `registryVersion` against a registry search, or remove
the pack.
- `build_spec_stale` — the remote moved under you, or `--id` names a Build the
spec's `syncedRevision` does not belong to. See *Revising*.

Expand Down
20 changes: 14 additions & 6 deletions comfy_cli/skills/comfy-build/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@ comfy build validate <install>
comfy build push <install> --dry-run
```

Everything above is offline and spends nothing. `validate` reads the spec, and
`--dry-run` computes every upload without instantiating an HTTP client at all.
Read what it plans, decide the pins, run the conflict prediction in
`comfy-build-pins`, disclose, get a yes. Only then:
Everything above spends nothing. `validate` reads the spec offline. `--dry-run`
computes every upload locally and makes one read: it asks the builder to place
each public pack, and refuses with `build_registry_pin_missing` exactly as `push`
would, so a pin the push cannot save fails here, before you disclose the plan.
A spec that pins a public pack therefore needs sign-in for the dry run; one whose
packs are all local sends nothing. Read what it plans, decide the pins, run the
conflict prediction in `comfy-build-pins`, disclose, get a yes. Only then:

```shell
comfy build push <install>
Expand Down Expand Up @@ -192,7 +195,8 @@ comfy --json build init <dir> --name <name> --from-workflow <workflow>.json
never carries — `comfy-build-authoring` is that procedure.
- **The pack pins are the registry's newest published version**, because a
workflow names none. Importing the same file next week can then build something
else. Say that out loud.
else. Say that out loud. The newest can be a version the registry has Flagged,
which the builder will not place, so run `push --dry-run` before you disclose.
- **A workflow names no ComfyUI version either**, so set one before cutting:
`comfy build update <dir> --comfy-version <ref>`, or edit `baseComfyVersion`.
- **`unresolvedClasses` is the list to take to the user.** Those node classes are
Expand Down Expand Up @@ -227,7 +231,11 @@ show the user rather than as instructions to act on.
- **Whether a registry pin exists.** `push` asks the builder to place every
public pack before it saves, and refuses with `build_registry_pin_missing`
naming each identity it could not resolve. If that lookup itself fails, the
command **exits** — it does not warn and proceed.
command **exits** — it does not warn and proceed. `push --dry-run` makes the
same check. A version the registry has **Flagged** is refused this way too,
and the message does not say so: read the version's `status` from
`https://api.comfy.org/nodes/<id>/versions`, then pin a version that is not
`NodeVersionStatusFlagged`, or pin the pack by `repository` and a commit `gitRef`.

**A local pack is uploaded from the spec.** `push` packages each custom node
directory and uploads it, so a pack that publishes nothing still travels.
Expand Down
21 changes: 20 additions & 1 deletion tests/comfy_cli/command/build_auth_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# Keyed on the URL *path* so a route carrying query parameters (`?cursor=`,
# `?os=&gpu=`) still matches.
_ROUTES: dict[tuple[str, str], tuple[int, JsonObject]] = {
("POST", "/v1/snapshots/resolve"): (200, {"definition": _EMPTY_DEFINITION, "report": {}}),
("POST", "/v1/builds"): (201, {"id": BUILD_ID, "updatedAt": REVISION}),
("GET", "/v1/builds"): (200, {"builds": [{"id": BUILD_ID, "name": "Matrix"}]}),
("GET", f"/v1/builds/{BUILD_ID}"): (
Expand Down Expand Up @@ -99,6 +98,8 @@ def __call__(
path = urlsplit(url).path
if (method, path) == ("POST", "/v1/models/resolve"):
return 200, {"results": _resolved_filenames(body)}
if (method, path) == ("POST", "/v1/snapshots/resolve"):
return 200, {"definition": {"models": [], "customNodes": _placed_nodes(body)}, "report": {}}
route = _ROUTES.get((method, path))
if route is None:
pytest.fail(f"unexpected Builder call: {method} {url}")
Expand All @@ -113,6 +114,24 @@ def _resolved_filenames(body: JsonObject | None) -> list[JsonValue]:
return [{"filename": filename, "candidates": []} for filename in filenames]


def _placed_nodes(body: JsonObject | None) -> list[JsonValue]:
"""Every pack the snapshot names, placed as asked: the importer vouches for
each pin, so a push or dry run that sends one gets past its pin check."""
assert body is not None
snapshot = body["snapshot"]
assert isinstance(snapshot, dict)
placed: list[JsonValue] = []
for entry in snapshot.get("snapshots") or []:
assert isinstance(entry, dict)
for node in entry.get("customNodes") or []:
assert isinstance(node, dict)
if node["type"] == "cnr":
placed.append({"name": node["dirName"], "id": node["id"], "registryVersion": node["version"]})
else:
placed.append({"name": node["dirName"], "repository": node["url"]})
return placed


def write_snapshot(root: Path) -> Path:
path = root / "snapshot.json"
path.write_text(json.dumps({"customNodes": [], "pipPackages": {}, "pythonVersion": "3.12"}), encoding="utf-8")
Expand Down
16 changes: 15 additions & 1 deletion tests/comfy_cli/command/test_assets_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,22 @@ def reset_singleton():
reset_renderer_for_testing()


@pytest.fixture(scope="module")
def root_cli_ready():
"""Load the actual CLI before a test's target fake can bind into lazy modules."""
from click import Context
from typer.main import get_command

from comfy_cli.cmdline import app as root_app

root = get_command(root_app)
with Context(root) as context:
for name in root.list_commands(context):
root.get_command(context, name)


@pytest.fixture
def cloud_target(monkeypatch: pytest.MonkeyPatch):
def cloud_target(monkeypatch: pytest.MonkeyPatch, root_cli_ready):
from comfy_cli.target import Target

fake = Target(
Expand Down
13 changes: 13 additions & 0 deletions tests/comfy_cli/command/test_build_auth_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class FixtureKind(Enum):
VALIDATE_REMOTE_LOOKUP = "validate --remote (lookupable)"
PUSH = "push"
PUSH_DRY_RUN = "push --dry-run"
PUSH_DRY_RUN_PINNED = "push --dry-run (public pins)"
PULL = "pull"
STATUS = "status"
LS = "ls"
Expand Down Expand Up @@ -95,7 +96,10 @@ class BuildAuthCase:
BuildAuthCase(FixtureKind.VALIDATE_REMOTE_ZERO, "validate", True, _ZERO_PLUS, 1),
BuildAuthCase(FixtureKind.VALIDATE_REMOTE_LOOKUP, "validate", True, _ZERO_PLUS, 2),
BuildAuthCase(FixtureKind.PUSH, "push", True, _ONE_PLUS),
# A dry run asks the builder only to place the spec's public pins, the read the
# push makes before it saves, so a spec without one stays signed out and silent.
BuildAuthCase(FixtureKind.PUSH_DRY_RUN, "push", False, _ZERO),
BuildAuthCase(FixtureKind.PUSH_DRY_RUN_PINNED, "push", True, _ONE_PLUS, 1),
BuildAuthCase(FixtureKind.PULL, "pull", True, _ONE_PLUS),
BuildAuthCase(FixtureKind.STATUS, "status", True, _ONE_PLUS),
BuildAuthCase(FixtureKind.LS, "ls", True, _ONE_PLUS),
Expand Down Expand Up @@ -165,6 +169,15 @@ def _prepare(kind: FixtureKind, root: Path) -> list[str]:
case FixtureKind.PUSH_DRY_RUN:
write_spec(root, models=[], nodes=[])
return ["build", "push", "--dry-run", str(root)]
case FixtureKind.PUSH_DRY_RUN_PINNED:
write_spec(
root,
models=[],
nodes=[
{"name": "registry-node", "id": "registry-node", "registryVersion": "1.0.0", "source": "registry"}
],
)
return ["build", "push", "--dry-run", str(root)]
case FixtureKind.PULL:
write_spec(root, models=[], nodes=[])
return ["build", "pull", "-y", "--id", BUILD_ID, str(root)]
Expand Down
Loading
Loading