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
29 changes: 26 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,27 @@ 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 workflow save --where cloud` saves the workflow where the Cloud
Workflows sidebar lists it, as `workflows/<name>.json`, so it shows there and
opens from it. It used to create only an `/api/workflows` record, which the
sidebar never shows. Cloud keeps a record for the file, and `workflow_id` and
`latest_version` are read back from it by name; when exactly one record by
that name with matching content can't be read back they are null, with a
`workflow_record_unresolved` warning, and the save still succeeds. `--json`
also carries `filename`, `size` and `modified`. `saved_file_id` identifies
the actual userdata file, separately from `workflow_id`; it is null with
`saved_file_identity_unavailable` when the server write receipt cannot
certify it. A same-name save replaces the
workflow, as the Cloud editor's Save does, where it used to add a second
record with the same name; the new `--no-overwrite` refuses it with
`workflow_exists` instead, on both routes. On Cloud `--description` is now
ignored with a `description_ignored` warning, since the file has no
description field. A save named `.index.json`, the folder's favorites file,
is refused, as are Cloud dotfiles or hidden folders that the sidebar never
lists. Cloud deletion now removes the sidebar file as well as its record;
ambiguous same-name records are refused before deletion, and partial cleanup
reports `workflow_delete_incomplete` with the file's deletion state.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

- 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 +131,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
424 changes: 338 additions & 86 deletions comfy_cli/command/workflow.py

Large diffs are not rendered by default.

47 changes: 42 additions & 5 deletions comfy_cli/error_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,46 @@ class ErrorCode:
"truncate it into a corrupt/partial file. `details.limit_bytes` carries the cap.",
"the saved workflow is unexpectedly large; inspect it directly on the server",
),
ErrorCode(
"workflow_exists",
"`comfy workflow save --no-overwrite` found a saved workflow file with that name already (HTTP 409 "
"from the `/userdata` write), so nothing was written. `details.filename` is the file under "
"`workflows/`.",
"pass a different `--name`, or drop `--no-overwrite` to replace it",
),
ErrorCode(
"saved_file_identity_unavailable",
"`comfy workflow save --where cloud` saved the sidebar file, but its write receipt did not return "
"a usable canonical userdata UUID for that exact path. `saved_file_id` is null. Surfaced in "
"`data.warnings[]`: the save succeeded; a same-name or equal-content workflow record does not "
"certify file identity.",
"verify the file in Cloud's Workflows sidebar; do not repeat the save or uploads solely to obtain an ID",
),
ErrorCode(
"workflow_record_unresolved",
"`comfy workflow save --where cloud` saved the file the Workflows sidebar lists, but could not read "
"back exactly one Cloud workflow record with that name and matching content (none yet, two sharing it, "
"stale mirrored content, or the `/api/workflows` read failed), so `workflow_id` is null. "
"Surfaced in `data.warnings[]`, not as an "
"error envelope: the save succeeded, so do not re-run it.",
"find the record with `comfy --json workflow list --name <name>`",
),
ErrorCode(
"workflow_filename_ambiguous",
"Cloud `workflow delete` could not safely associate a sidebar filename or file with the requested record "
"because its name, content, or ownership could not be verified. Nothing was deleted.",
"inspect the record and sidebar file; verify the name, content, and ownership before any manual cleanup",
),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
ErrorCode(
"workflow_delete_incomplete",
"Cloud `workflow delete` removed the sidebar file, but could not confirm cleanup of its workflow "
"record. `details.file_deleted` is true; `details.workflow_id` identifies the record to check.",
"check `comfy --json workflow list`, then retry deleting the record if it remains",
),
ErrorCode(
"workflow_unparseable",
"A cloud `/api/workflows` call returned a non-empty 200 body that couldn't be decoded as JSON "
"A cloud `/api/workflows` call, or the cloud `/userdata` write `workflow save` makes, returned a "
"non-empty 200 body that couldn't be decoded as JSON "
"(non-UTF-8 bytes or a non-JSON body such as an HTML proxy/error page). Distinct from an empty "
"body (legitimately no data): the malformed body is surfaced as a hard error rather than a "
"misleading empty list / null id. `details.operation` carries the verb.",
Expand Down Expand Up @@ -956,10 +993,10 @@ class ErrorCode:
),
ErrorCode(
"description_ignored",
"`comfy workflow save --where local --description` was given a description, but the local "
"file-backed `/userdata` store has nowhere to keep it. Surfaced in `data.warnings[]` "
"(not as an error envelope) so the save still succeeds.",
"descriptions are a Comfy Cloud feature; drop `--description` on the local path",
"`comfy workflow save --description` was given a description, but the saved workflow is a "
"`/userdata` file (on Cloud, the one the Workflows sidebar lists) with nowhere to keep it. "
"Surfaced in `data.warnings[]` (not as an error envelope) so the save still succeeds.",
"drop `--description`; put notes in the workflow itself, e.g. a Note node",
),
ErrorCode(
"cql_query_invalid",
Expand Down
17 changes: 17 additions & 0 deletions comfy_cli/saved_file_identity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Saved userdata UUID contract shared by save receipts and link publication."""

from __future__ import annotations

import re

# Browser consumer: uuid11.1.1 validate(), plus lowercase canonical wire form.
# Accept RFC9562 versions1..8 and variants8..b, plus its explicit NIL/MAX cases.
_SAVED_FILE_UUID = re.compile(
r"(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}"
r"|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)"
)


def canonical_saved_file_id(value: object) -> str | None:
"""Return a received canonical ID, without deriving or coercing one."""
return value if isinstance(value, str) and _SAVED_FILE_UUID.fullmatch(value) else None
5 changes: 5 additions & 0 deletions comfy_cli/schemas/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"type": "object",
"properties": {
"workflow": { "type": "string" },
"saved_file_id": {
"type": ["string", "null"],
"format": "uuid",
"description": "Cloud save: actual userdata UUID from the write receipt, distinct from the mirrored workflow_id record. Null when the server cannot certify file identity; do not repeat the save."
},
"count": { "type": "integer" },
"total": {
"type": "integer",
Expand Down
18 changes: 17 additions & 1 deletion comfy_cli/skills/comfy/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,26 @@ JSON files on disk via `workflow slots/set-slot/vary` instead.
comfy --json workflow list # paginated, sorted by create_time
comfy --json workflow list --name "wan" --limit 5 # case-insensitive name filter
comfy --json workflow get <id> --out my.json # writes workflow JSON
comfy --json workflow save my.json --name "X" --description "Y"
comfy --json workflow save my.json --name "X" # → workflows/X.json in the sidebar
comfy --json workflow save my.json --name "X" --no-overwrite # refuse if X exists
comfy --json workflow delete <id>
```

`workflow save` writes `workflows/<name>.json`, the file the Cloud
**Workflows sidebar** lists, so tell the user it is there under that name
(an open tab needs a refresh) and opens from it. `data.filename` is that
entry; `data.workflow_id` is the record Cloud keeps for it. A
`workflow_record_unresolved` warning means only the id read-back failed —
the save landed, but the record may be missing or stale, so don't re-run it.
A same-name save replaces the
workflow; `--no-overwrite` refuses with `workflow_exists` instead.
`--description` is ignored (the file has no such field).
Cloud `workflow delete <id>` removes the sidebar file and record. If duplicate
names make the file association ambiguous, it leaves both unchanged with
`workflow_filename_ambiguous`; inspect the same-name records and remove the
intended file in the sidebar first. `workflow_delete_incomplete` means the file
was removed but record cleanup needs checking with `workflow list`.

## Cancel a running job

```bash
Expand Down
18 changes: 18 additions & 0 deletions docs/workflow-save.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Saving a workflow to the Cloud sidebar

`comfy --json workflow save workflow.json --name "My workflow" --where cloud`
writes the normal `workflows/My workflow.json` userdata file once. It returns
`filename` and, when supported by the server, `saved_file_id`: the actual userdata
UUID from that write receipt. The UUID survives ordinary saves and renames; a
deleted and recreated file has a new identity.

`workflow_id` remains the separate mirrored workflow-record ID used by the
record-based list/get/delete commands. A same-name record with equal content does
not establish the saved file's UUID. Never substitute `workflow_id` for
`saved_file_id` or construct a private editor URL from either value alone.

Older servers can save successfully without returning a usable file UUID. In
that case `saved_file_id` is null and `saved_file_identity_unavailable` explains
that private file-link certification is unavailable. Verify the saved file in
Cloud's Workflows sidebar; do not repeat the save or any local file uploads to
obtain an ID. File identity metadata does not grant upload permission.
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
28 changes: 28 additions & 0 deletions tests/comfy_cli/command/test_pretty_print_sanitize.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,34 @@ def test_local_workflow_list_table_is_inert(pretty):
assert "boom" in assert_inert(pretty)


def test_cloud_workflow_save_receipt_names_the_sidebar_and_is_inert(pretty, tmp_path):
"""`comfy workflow save --where cloud` prints the sidebar entry it wrote and
the record id Cloud returned, which is server-supplied; a warning is printed
too, since pretty mode drops `data.warnings`."""
from comfy_cli.command import workflow

src = tmp_path / "wf.json"
src.write_text(json.dumps({"nodes": [], "links": []}))
record = {"id": EVIL, "name": "flux", "latest_version": 1}
target = MagicMock()
target.url.side_effect = lambda *parts: "https://cloud.example/api/" + "/".join(parts)

def _fake_http(url, _target, *, method="GET", body=None):
if method == "POST":
return (200, {"size": 2})
if url.endswith("/content"):
return (200, {"workflow_json": {"nodes": [], "links": []}})
return (200, {"data": [record]})

with patch.object(workflow, "_http_request", side_effect=_fake_http):
workflow._cloud_save(get_renderer(), target, str(src), "flux", "a note")
out = assert_inert(pretty)
assert "Cloud Workflows sidebar" in out
assert "workflows/flux.json" in out
assert "boom" in out
assert "--description is ignored" in out


def test_cloud_workflow_list_table_is_inert(pretty):
"""The cloud saved-workflow catalog reaches the same sink."""
from comfy_cli.command import workflow
Expand Down
34 changes: 25 additions & 9 deletions tests/comfy_cli/command/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2363,14 +2363,29 @@ def test_markup_in_node_name_does_not_crash_confirm(self, monkeypatch):


class TestExecuteUiWorkflow:
@pytest.fixture(autouse=True)
def local_preflight_catalog(self, monkeypatch):
"""Validate against the complete conversion fixture without a live server."""
from copy import deepcopy

monkeypatch.setattr("comfy_cli.command.run._fetch_object_info", lambda *a, **k: deepcopy(self.OBJECT_INFO))

def unexpected_catalog_request(*args, **kwargs):
pytest.fail("unexpected real catalog request; mock the specific object_info transport")

monkeypatch.setattr("comfy_cli.http._PLAIN_OPENER.open", unexpected_catalog_request)
monkeypatch.setattr("comfy_cli.cql.engine._load_from_target", unexpected_catalog_request)

# The conversion success fixture must also be an executable graph:
# PreviewImage consumes IMAGE, not an EmptyLatentImage's LATENT output.
UI = {
"nodes": [
{
"id": 1,
"type": "EmptyLatentImage",
"type": "EmptyImage",
"inputs": [],
"outputs": [{"name": "LATENT", "type": "LATENT", "links": [10]}],
"widgets_values": [512, 512, 1],
"outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [10]}],
"widgets_values": [512, 512, 1, 0],
"mode": 0,
},
{
Expand All @@ -2384,19 +2399,20 @@ class TestExecuteUiWorkflow:
"links": [[10, 1, 0, 2, 0, "IMAGE"]],
}
OBJECT_INFO = {
"EmptyLatentImage": {
"EmptyImage": {
"input": {
"required": {
"width": ["INT", {"default": 512}],
"height": ["INT", {"default": 512}],
"batch_size": ["INT", {"default": 1}],
"color": ["INT", {"default": 0}],
}
},
"input_order": {"required": ["width", "height", "batch_size"]},
"output": ["LATENT"],
"output_name": ["LATENT"],
"input_order": {"required": ["width", "height", "batch_size", "color"]},
"output": ["IMAGE"],
"output_name": ["IMAGE"],
"output_node": False,
"display_name": "Empty Latent Image",
"display_name": "Empty Image",
},
"PreviewImage": {
"input": {"required": {"images": ["IMAGE"]}},
Expand Down Expand Up @@ -2435,7 +2451,7 @@ def test_ui_workflow_is_converted_then_executed(self, ui_workflow_file):
assert mock_fetch.call_args.args == ("127.0.0.1", 8188, 30)
api_workflow = MockExec.call_args.args[0]
assert set(api_workflow) == {"1", "2"}
assert api_workflow["1"]["class_type"] == "EmptyLatentImage"
assert api_workflow["1"]["class_type"] == "EmptyImage"
assert api_workflow["2"]["inputs"]["images"] == ["1", 0]
mock_exec.queue.assert_called_once()

Expand Down
Loading
Loading