From ca43f43e68fac68c1614437ab79ec3f257525cbe Mon Sep 17 00:00:00 2001 From: digital-garbage <133010426+digital-garbage@users.noreply.github.com> Date: Thu, 15 Oct 2026 23:55:24 +0300 Subject: [PATCH] fix: a model probe whose detector raised says so instead of 'nobody recognises it'; routes and shot camera failures worded truthfully (attacker round 23) Co-Authored-By: Claude Sonnet 5.5 --- core/probe.py | 5 ++++- core/routes.py | 2 +- core/tests/test_probe.py | 12 ++++++++++++ modules/conditioning/shot_camera/nodes.py | 4 ++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/core/probe.py b/core/probe.py index 2e9a12c0..e3df5d31 100644 --- a/core/probe.py +++ b/core/probe.py @@ -106,10 +106,12 @@ def detect(path: Path, registry=None) -> dict: keyset = set(keys) reg = registry or registry_mod.current() + broken = [] for spec, claims in reg.providers("detect"): try: matched = claims(keyset) except Exception as exc: # noqa: BLE001 + broken.append(spec.id) from . import log log.once(f"provider:{spec.id}.detect:{type(exc).__name__}", log.WARNING, f"{spec.id}.detect", f"failed while answering -- {type(exc).__name__}: {exc}") continue @@ -125,5 +127,6 @@ def detect(path: Path, registry=None) -> dict: return {"module": spec.id, "title": spec.title, "detected": True, "reason": f"{p.name}: {spec.title}", "traits": traits} return {"module": None, "title": None, "detected": False, - "reason": f"{p.name}: no installed model module recognises this file", + "reason": f"{p.name}: no installed model module recognises this file" + + (f" ({', '.join(broken)} failed while checking it: see the Log)" if broken else ""), "traits": []} diff --git a/core/routes.py b/core/routes.py index 007cb792..bd7f60d2 100644 --- a/core/routes.py +++ b/core/routes.py @@ -248,7 +248,7 @@ def register(routes, prefix=None): try: mount(routes, f"{P}/api/m/{spec.id}", web) except Exception as exc: # noqa: BLE001 - log.failed(f"{spec.id}.routes", exc) + _provider_failed(f"{spec.id}.routes", exc) @routes.get(P + "/api/pipeline") async def _pipeline_get(_req): diff --git a/core/tests/test_probe.py b/core/tests/test_probe.py index 3447744c..f0d387cf 100644 --- a/core/tests/test_probe.py +++ b/core/tests/test_probe.py @@ -182,6 +182,18 @@ def test_a_detector_that_raises_is_skipped_not_fatal(tmp_path): assert out["module"] == "good" +def test_when_the_only_detector_raises_the_reason_says_so_not_that_nobody_recognises_the_file(tmp_path): + from core import log + log._reset() + p = tmp_path / "m.safetensors" + _write_safetensors(p, ["real.weight"]) + reg = Registry() + reg.add(ModuleSpec(id="bad", title="Bad", mount="", provides={"detect": lambda _k: 1 / 0})) + out = probe.detect(p, registry=reg) + assert not out["detected"] and "bad failed while checking it" in out["reason"] + assert any("bad.detect" in r["source"] and "failed while answering" in r["message"] for r in log.history()) + + # --- resolve_diffusion_model ------------------------------------------------- # # `folder_paths` only exists inside a running ComfyUI, and whether it happens diff --git a/modules/conditioning/shot_camera/nodes.py b/modules/conditioning/shot_camera/nodes.py index d8a613d7..19a2fc01 100644 --- a/modules/conditioning/shot_camera/nodes.py +++ b/modules/conditioning/shot_camera/nodes.py @@ -126,13 +126,13 @@ class FunPackShotCamera(io.ComfyNode): try: out, said, chose = rewrite(text, values, seconds=length / frame_rate if frame_rate else None, project=project) except Exception as exc: # noqa: BLE001 -- a rewrite is never worth the run - log.failed("FunPack Shot Camera", exc) + log.broke("FunPack Shot Camera", exc, "rewriting the prompt") return io.NodeOutput(text, f"left as written ({exc})") pid = _prompt_id() if pid and (chose["views"] or chose["arms"] or chose.get("text") is not None): try: memory.record_run(pid, chose) except Exception as exc: # noqa: BLE001 -- only the learning is lost, not the run - log.failed("FunPack Shot Camera", exc) + log.broke("FunPack Shot Camera", exc, "remembering this run") log.info("FunPack Shot Camera", said) return io.NodeOutput(out, said)