mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 02:11:48 +00:00
fix(skills/comfyui): bug fixes, cloud parity, expanded coverage, examples, tests
The audit of v4.1 surfaced ~70 issues across the five scripts and three
reference docs — most user-visible (silent file overwrites, status-error
misclassified as success, X-API-Key leaked to S3 on /api/view redirect,
Cloud endpoints that 404 because they were renamed). v5.0.0 fixes those
and fills the gaps that previously forced users to write their own glue
(WebSocket monitoring, batch/sweep, img2img upload helper, dep auto-fix,
log fetch, health check, example workflows).
Critical fixes
- run_workflow.py: poll_status now checks status_str==error BEFORE
completed:true, so a failed run no longer reports success
- run_workflow.py: download_output streams to disk via safe_path_join,
preserves server subfolder structure (no silent overwrites), and
retries with exponential backoff
- run_workflow.py: refuses to overwrite a link with a literal in
inject_params (would silently break wiring)
- _common.py: _StripSensitiveOnRedirectSession (subclasses
requests.Session.rebuild_auth) drops X-API-Key/Cookie on cross-host
redirects — fixes a real key-leak path through Cloud's signed-URL
download flow. Tested
- Cloud routing (verified live): /history → /history_v2,
/models/<f> → /experiment/models/<f>, plus folder aliases for the
unet ↔ diffusion_models and clip ↔ text_encoders rename
- check_deps.py: distinguishes 200/empty vs 404 folder_not_found vs
403 free-tier; emits concrete fix_command per missing dep
- extract_schema.py: prompt vs negative_prompt determined by tracing
KSampler.{positive,negative} connections (incl. through Reroute /
Primitive nodes) instead of meta-title heuristic; symmetric
duplicate-name resolution; cycle-safe trace_to_node
- hardware_check.py: multi-GPU pick-best, Apple variant detection,
Rosetta detection, WSL2, ROCm --json, disk-space check, optional
PyTorch probe; powershell preferred over deprecated wmic
- comfyui_setup.sh: prefers pipx → uvx → pip --user (with PEP-668
fallback); idempotent — skips relaunch if server already up;
configurable port/workspace; persistent log; SIGINT trap
New scripts
- run_batch.py — count or sweep (cartesian product), parallel up to
cloud tier limit
- ws_monitor.py — real-time WebSocket viewer; saves preview frames
- auto_fix_deps.py — runs comfy node install / model download for
whatever check_deps reports missing (with --dry-run)
- health_check.py — single command that runs the verification checklist
(comfy-cli + server + checkpoints + optional smoke test that cancels
itself to avoid burning compute)
- fetch_logs.py — pull traceback / status messages for a prompt_id
Coverage expansion
- Param patterns now cover Flux (BasicScheduler, BasicGuider,
RandomNoise, ModelSamplingFlux), SD3, Wan/Hunyuan/LTX video,
IPAdapter, rgthree, easy-use, AnimateDiff
- Embedding refs in CLIPTextEncode strings extracted as model deps
- ckpt_name / vae_name / lora_name / unet_name now controllable so
workflows can be retargeted per run
Examples
- workflows/{sd15,sdxl,flux_dev}_txt2img.json
- workflows/sdxl_{img2img,inpaint}.json
- workflows/upscale_4x.json
- workflows/{animatediff_video,wan_video_t2v}.json + README
Tests
- 117 tests (105 unit + 8 cloud integration + 4 cross-host security)
- Cloud tests auto-skip without COMFY_CLOUD_API_KEY; verified end-to-end
against live cloud API
Backwards compatibility
- All existing CLI flags continue to work; new behavior is opt-in
(--ws, --input-image, --randomize-seed, --flat-output, etc.)
This commit is contained in:
parent
7d48a16f14
commit
a7780fe05f
32 changed files with 6117 additions and 1372 deletions
65
skills/creative/comfyui/tests/test_check_deps.py
Normal file
65
skills/creative/comfyui/tests/test_check_deps.py
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
"""Tests for check_deps.py — focuses on parsing logic that doesn't need a server."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from check_deps import (
|
||||
NODE_TO_PACKAGE,
|
||||
model_present,
|
||||
normalize_for_match,
|
||||
suggest_install_command,
|
||||
)
|
||||
|
||||
|
||||
class TestNormalizeForMatch:
|
||||
def test_basic(self):
|
||||
s = normalize_for_match("model.safetensors")
|
||||
assert "model.safetensors" in s
|
||||
assert "model" in s
|
||||
|
||||
def test_subfolder(self):
|
||||
s = normalize_for_match("subdir/model.pt")
|
||||
assert "subdir/model.pt" in s
|
||||
assert "model.pt" in s
|
||||
assert "model" in s
|
||||
|
||||
|
||||
class TestModelPresent:
|
||||
def test_exact_match(self):
|
||||
assert model_present("a.safetensors", {"a.safetensors", "b.safetensors"}) is True
|
||||
|
||||
def test_extension_difference(self):
|
||||
# User said "model" but installed is "model.safetensors"
|
||||
assert model_present("model", {"model.safetensors"}) is True
|
||||
# Reverse direction — also matches
|
||||
assert model_present("model.safetensors", {"model"}) is True
|
||||
|
||||
def test_subfolder_match(self):
|
||||
# Installed list has "subdir/model.safetensors", workflow asks "model.safetensors"
|
||||
assert model_present("model.safetensors", {"subdir/model.safetensors"}) is True
|
||||
|
||||
def test_missing(self):
|
||||
assert model_present("missing.safetensors", {"a.safetensors", "b.safetensors"}) is False
|
||||
|
||||
def test_empty_installed(self):
|
||||
assert model_present("anything.safetensors", set()) is False
|
||||
|
||||
|
||||
class TestSuggestInstallCommand:
|
||||
def test_known_node(self):
|
||||
cmd = suggest_install_command("VHS_VideoCombine")
|
||||
assert cmd == "comfy node install comfyui-videohelpersuite"
|
||||
|
||||
def test_unknown_node(self):
|
||||
assert suggest_install_command("SomeRandomNodeName123") is None
|
||||
|
||||
|
||||
class TestNodePackageMap:
|
||||
def test_no_duplicates(self):
|
||||
# Each node should map to exactly one package
|
||||
keys = list(NODE_TO_PACKAGE.keys())
|
||||
assert len(keys) == len(set(keys))
|
||||
|
||||
def test_all_lowercase_packages(self):
|
||||
# Convention: package names are lowercase with hyphens/underscores
|
||||
for pkg in NODE_TO_PACKAGE.values():
|
||||
assert pkg.lower() == pkg, f"Package name should be lowercase: {pkg}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue