[PR #2693] [MERGED] feat(cli): add update-cache command, purge reinstall fallback, and batch failure tracking #2697

Closed
opened 2026-10-28 21:11:52 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/ComfyUI-Manager/pull/2693
Author: @ltdrdata
Created: 3/15/2026
Status: ✅ Merged
Merged: 3/15/2026
Merged by: @ltdrdata

Base: manager-v4 ← Head: feat/cm-cli-update-cache


📝 Commits (1)

  • dcd5c00 feat(cli): add update-cache command, purge reinstall fallback, and batch failure tracking

📊 Changes

4 files changed (+243 additions, -12 deletions)

View changed files

📝 cm_cli/__main__.py (+112 -11)
📝 comfyui_manager/glob/manager_core.py (+65 -0)
📝 comfyui_manager/legacy/manager_core.py (+65 -0)
📝 pyproject.toml (+1 -1)

📄 Description

Summary

  • Add cm-cli update-cache command for blocking cache population, bypassing pip/offline guards
  • Add purge_node_state() to fix reinstall categorization mismatch (e.g. unknown→nightly)
  • Add NodeInstallError exception and batch failure tracking to for_each_nodes

Motivation

update-cache: pip-installed cm-cli could never populate CNR cache without running the web server first. get_data_by_mode() hardcodes is_manager_pip_package() to force offline path, and reload() forces dont_wait=True for pip packages, causing get_cnr_data() to return {} permanently. The new command bypasses both guards by directly fetching channel JSON files and calling reload('remote').

purge_node_state: When a node's categorization changes between cm-cli invocations (e.g. unknown→nightly), unified_uninstall may miss cleaning up state from the wrong category dictionary, leaving stale directories that block reinstallation.

batch failure tracking: for_each_nodes previously swallowed errors silently. Now it tracks failed nodes and reports an aggregate summary with non-zero exit code.

Changes

cm_cli/__main__.py

  • Add NodeInstallError(Exception) — dedicated exception for install failure propagation
  • Add update-cache command: fetches 5 channel JSON files in parallel + CNR registry + nightly data, with per-item failure tracking and sys.exit(1) on partial failure
  • Modify install_node: replace exit_on_fail/sys.exit(1) with raise_on_fail/raise NodeInstallError
  • Modify reinstall_node: add purge_node_state() fallback after unified_uninstall, pass raise_on_fail=True
  • Modify for_each_nodes: catch NodeInstallError + Exception, track failures, report aggregate summary
  • Remove debug print statement

comfyui_manager/glob/manager_core.py + legacy/manager_core.py

  • Add UnifiedManager.purge_node_state() to both packages (cm-cli imports from legacy)
  • Path traversal protection via os.path.commonpath
  • Root directory and comfyui-manager self-protection guards
  • finally-guarded dictionary cleanup for all 5 internal state dicts

pyproject.toml

  • Bump version 4.1b4 → 4.1b5

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/ComfyUI-Manager/pull/2693 **Author:** [@ltdrdata](https://github.com/ltdrdata) **Created:** 3/15/2026 **Status:** ✅ Merged **Merged:** 3/15/2026 **Merged by:** [@ltdrdata](https://github.com/ltdrdata) **Base:** `manager-v4` ← **Head:** `feat/cm-cli-update-cache` --- ### 📝 Commits (1) - [`dcd5c00`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/dcd5c00794665fad74224dc0af5ed352b5aaea9b) feat(cli): add update-cache command, purge reinstall fallback, and batch failure tracking ### 📊 Changes **4 files changed** (+243 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `cm_cli/__main__.py` (+112 -11) 📝 `comfyui_manager/glob/manager_core.py` (+65 -0) 📝 `comfyui_manager/legacy/manager_core.py` (+65 -0) 📝 `pyproject.toml` (+1 -1) </details> ### 📄 Description ## Summary - Add `cm-cli update-cache` command for blocking cache population, bypassing pip/offline guards - Add `purge_node_state()` to fix reinstall categorization mismatch (e.g. unknown→nightly) - Add `NodeInstallError` exception and batch failure tracking to `for_each_nodes` ## Motivation **update-cache**: pip-installed cm-cli could never populate CNR cache without running the web server first. `get_data_by_mode()` hardcodes `is_manager_pip_package()` to force offline path, and `reload()` forces `dont_wait=True` for pip packages, causing `get_cnr_data()` to return `{}` permanently. The new command bypasses both guards by directly fetching channel JSON files and calling `reload('remote')`. **purge_node_state**: When a node's categorization changes between cm-cli invocations (e.g. unknown→nightly), `unified_uninstall` may miss cleaning up state from the wrong category dictionary, leaving stale directories that block reinstallation. **batch failure tracking**: `for_each_nodes` previously swallowed errors silently. Now it tracks failed nodes and reports an aggregate summary with non-zero exit code. ## Changes ### `cm_cli/__main__.py` - Add `NodeInstallError(Exception)` — dedicated exception for install failure propagation - Add `update-cache` command: fetches 5 channel JSON files in parallel + CNR registry + nightly data, with per-item failure tracking and `sys.exit(1)` on partial failure - Modify `install_node`: replace `exit_on_fail`/`sys.exit(1)` with `raise_on_fail`/`raise NodeInstallError` - Modify `reinstall_node`: add `purge_node_state()` fallback after `unified_uninstall`, pass `raise_on_fail=True` - Modify `for_each_nodes`: catch `NodeInstallError` + `Exception`, track failures, report aggregate summary - Remove debug print statement ### `comfyui_manager/glob/manager_core.py` + `legacy/manager_core.py` - Add `UnifiedManager.purge_node_state()` to both packages (cm-cli imports from legacy) - Path traversal protection via `os.path.commonpath` - Root directory and comfyui-manager self-protection guards - `finally`-guarded dictionary cleanup for all 5 internal state dicts ### `pyproject.toml` - Bump version 4.1b4 → 4.1b5 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-28 21:11:52 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#2697
No description provided.