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
14 changes: 11 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,12 @@ 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 node deps` reports malformed installed package versions as `unknown`
consistently across supported `packaging` versions. One metadata probe
preserves raw installed versions with or without pip. Every `===` clause
compares raw strings case-insensitively, including in mixed constraints;
ordinary clauses still require valid versions and use semantic comparison.

- 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 +116,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
64 changes: 32 additions & 32 deletions comfy_cli/command/node_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@

``--registry <node-id>`` extends the same diff to a pack that is **not yet
installed**: the registry's published dependency list for that pack's latest
version, diffed against the very same ``pip list`` map, so conflict risk can be
version, diffed against the same installed-version map, so conflict risk can be
assessed *before* installing anything.

Read-only by construction: it never installs anything and never shells out to
``cm-cli``. The only subprocess it runs is a single ``<workspace python> -m pip
list --format=json`` for the whole report (not once per pack), plus one
``importlib.metadata`` listing in the same interpreter when that interpreter has
no pip (a ``uv venv`` ships without it). The only network
``cm-cli``. The only subprocess it runs is one guarded ``importlib.metadata``
listing in the workspace interpreter for the whole report (not once per pack).
It reads raw metadata versions whether or not pip is installed. The only network
call is the registry's side-effect-free ``GET /nodes/{id}``, made solely for
``--registry`` ids — never ``install_node``, whose endpoint records an
installation and fires an analytics event server-side on every call.
Expand All @@ -31,9 +30,9 @@
bare VCS/URL line, or anything else :class:`packaging.requirements.Requirement`
rejects. Kept in the report rather than dropped silently;
- ``unknown`` — the comparison could not be made: either the installed-
packages probe failed (``pip list`` and its ``importlib.metadata`` fallback;
accompanied by an ``installed_versions_unavailable`` warning on the report)
or the installed dist records a version that isn't PEP 440.
packages metadata probe failed (accompanied by an ``installed_versions_unavailable`` warning on the report)
or the installed dist records a version that isn't PEP 440 and the requirement
includes an operator other than literal ``===`` equality.

Known caveat: pyproject dependencies are read through the shared registry
parser (:func:`comfy_cli.command.pack_scan.read_pyproject`), which drops the
Expand Down Expand Up @@ -102,9 +101,9 @@
# ---------------------------------------------------------------------------


# Fallback probe for an interpreter without pip (a ``uv venv`` has none): the
# same ``[{"name", "version"}]`` shape as ``pip list --format=json``, read with
# the stdlib inside that interpreter.
# Read raw Name/Version metadata with the workspace interpreter's stdlib.
# `pip list` normalizes valid versions, losing spellings needed by `===`.
# The JSON shape stays [{"name", "version"}], with no pip dependency.
#
# - Before anything that could be shadowed is imported, every ``sys.path`` entry
# naming the caller's directory is dropped (the ``-c`` ``''`` entry and e.g.
Expand Down Expand Up @@ -175,23 +174,16 @@ def _list_installed(cmd: list[str], label: str) -> tuple[dict[str, str] | None,


def pip_list(python: str) -> tuple[dict[str, str] | None, str | None]:
"""Return ``(canonical_name -> version, error)`` for the workspace venv.

Runs ``<python> -m pip list --format=json`` once for the whole report. If
that exits non-zero — typically ``No module named pip`` in a uv-created
venv — the same interpreter is asked once more via ``importlib.metadata``.
A timeout or an interpreter that can't be started is not retried: the
fallback would hit the same wall and only double the wait. On failure the
map is ``None`` with a human-readable reason — a report that can't see the
venv is still a useful report.
"""Return ``(canonical_name -> raw metadata version, error)`` for the venv.

The legacy helper name is retained, but pip is never invoked: its display
output normalizes valid versions. One guarded ``importlib.metadata`` probe
preserves raw values and works in pip-less venvs too. A failed or timed-out
probe is not retried; the map is ``None`` with a human-readable reason so
the report can retain requirements with unknown installed versions.
"""
versions, pip_error, exited_nonzero = _list_installed([python, "-m", "pip", "list", "--format=json"], "`pip list`")
if versions is not None or not exited_nonzero:
return versions, pip_error
versions, metadata_error, _ = _list_installed([python, "-c", _METADATA_LIST_SCRIPT], "`importlib.metadata`")
if versions is not None:
return versions, None
return None, f"{pip_error}; {metadata_error}"
versions, error, _ = _list_installed([python, "-c", _METADATA_LIST_SCRIPT], "`importlib.metadata`")
return versions, error


# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -273,10 +265,18 @@ def _classify(raw: str, installed_versions: dict[str, str] | None) -> dict[str,
# A bare name is satisfied by any installed version.
row["status"] = "satisfied"
else:
from packaging.version import InvalidVersion
from packaging.version import InvalidVersion, Version

try:
contains = req.specifier.contains(installed, prereleases=True)
# Validate before any clause can short-circuit a mixed constraint.
if any(spec.operator != "===" for spec in req.specifier):
Version(installed)
contains = all(
installed.lower() == spec.version.lower()
if spec.operator == "==="
else spec.contains(installed, prereleases=True)
for spec in req.specifier
)
except InvalidVersion:
# A dist whose recorded version isn't PEP 440 (rare, but a broken
# `.dist-info` will do it) can't be compared. Say so rather than
Expand Down Expand Up @@ -500,7 +500,7 @@ def _registry_report(
row["warning"] = message
warnings.append({"code": "registry_partial_dependency_metadata", "message": message})

# Same per-requirement diff, against the same single ``pip list`` map.
# Same per-requirement diff, against the same single installed-version map.
rows: dict[str, dict[str, Any]] = {}
for line in declared:
if line not in rows:
Expand Down Expand Up @@ -557,14 +557,14 @@ def build_report(
workspace = Path(comfy_path)
python = python or resolve_workspace_python(comfy_path)

installed_versions, pip_error = pip_list(python)
installed_versions, probe_error = pip_list(python)
if installed_versions is None:
warnings.append(
{
"code": "installed_versions_unavailable",
"message": (
f"could not read installed packages from {python}"
+ (f" ({pip_error})" if pip_error else "")
+ (f" ({probe_error})" if probe_error else "")
+ " — every parseable requirement is reported with status 'unknown'"
),
}
Expand Down
6 changes: 3 additions & 3 deletions comfy_cli/error_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,9 +1304,9 @@ class ErrorCode:
# --- custom node dependency report (`comfy node deps`) --------------------
ErrorCode(
"installed_versions_unavailable",
"`comfy node deps` could not read the workspace venv's installed packages (`pip list --format=json` "
"timed out, returned unparseable output, or exited non-zero and its `importlib.metadata` fallback "
"failed too), so every parseable requirement is reported with "
"`comfy node deps` could not read the workspace venv's raw installed-package metadata "
"(the guarded `importlib.metadata` probe timed out, returned unparseable output, or failed), "
"so every parseable requirement is reported with "
'`status: "unknown"`. Surfaced in `data.warnings[]` (not as an error envelope) so the declared '
"requirements are still reported.",
"check the workspace interpreter runs (`comfy env`), then re-run",
Expand Down
8 changes: 4 additions & 4 deletions comfy_cli/schemas/node_deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"workspace": { "type": "string", "description": "Resolved ComfyUI workspace path." },
"python": {
"type": "string",
"description": "Interpreter whose site-packages were probed (`pip list --format=json`, run once for the whole report; an `importlib.metadata` listing in the same interpreter when it has no pip)."
"description": "Interpreter whose raw Name/Version metadata was read with one guarded importlib.metadata probe for the whole report, whether or not pip is installed."
},
"compiled_lock": {
"type": "object",
Expand Down Expand Up @@ -80,12 +80,12 @@
"source": { "type": "string", "enum": ["requirements.txt", "pyproject.toml", "registry"] },
"installed": {
"type": ["string", "null"],
"description": "Version found in the workspace venv, or null when missing/unparseable/unknown."
"description": "Raw metadata version found in the workspace venv, or null when missing/unparseable/unavailable."
},
"status": {
"type": "string",
"enum": ["satisfied", "mismatch", "missing", "unparseable", "unknown"],
"description": "`unparseable` covers pip options (-r, --extra-index-url) and bare VCS/URL lines; `unknown` means the comparison could not be made (the pip probe failed, or the installed dist records a non-PEP-440 version)."
"description": "`unparseable` covers pip options (-r, --extra-index-url) and bare VCS/URL lines; `unknown` means the comparison could not be made (the metadata probe failed, or the installed dist records a non-PEP-440 version and the requirement includes an operator other than ===). Each === clause compares raw strings case-insensitively; any other operator requires a PEP-440-valid installed version."
}
},
"required": ["raw", "name", "specifier", "source", "installed", "status"]
Expand All @@ -109,7 +109,7 @@
},
"warnings": {
"type": "array",
"description": "Non-fatal problems. `installed_versions_unavailable` means the installed-packages probe (pip, then importlib.metadata) failed, so every requirement is `unknown`. `registry_unavailable` (transient — retry) / `registry_node_not_found` (permanent 404 — do NOT retry) / `registry_no_dependency_metadata` mean a `--registry` candidate could not be diffed; `registry_partial_dependency_metadata` means its `declared` list lost malformed entries and is incomplete; `registry_invalid_node_id` means a `--registry` value was blank or outside `[A-Za-z0-9._-]` and was rejected without a request. Every other row is unaffected.",
"description": "Non-fatal problems. `installed_versions_unavailable` means the installed-packages metadata probe failed, so every requirement is `unknown`. `registry_unavailable` (transient — retry) / `registry_node_not_found` (permanent 404 — do NOT retry) / `registry_no_dependency_metadata` mean a `--registry` candidate could not be diffed; `registry_partial_dependency_metadata` means its `declared` list lost malformed entries and is incomplete; `registry_invalid_node_id` means a `--registry` value was blank or outside `[A-Za-z0-9._-]` and was rejected without a request. Every other row is unaffected.",
"items": {
"type": "object",
"properties": {
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
2 changes: 2 additions & 0 deletions tests/comfy_cli/command/test_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,8 @@ def test_logs_pretty_no_mismatch_warning_for_explicit_port(monkeypatch, tmp_path

def test_logs_pretty_warns_when_explicit_port_falls_back_to_unsuffixed(monkeypatch, tmp_path, capsys):
"""The unsuffixed fallback encodes no port, so say so instead of staying silent."""
# Assert routing and prose on a stable wide console, not path-dependent wrapping.
monkeypatch.setenv("COLUMNS", "512")
_write_log(tmp_path, "comfyui.log", "no --port in argv\n")
_fake_env(monkeypatch, workspace=tmp_path)

Expand Down
Loading
Loading