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 <noreply@anthropic.com>
This commit is contained in:
digital-garbage
2026-10-15 23:55:24 +03:00
co-authored by Claude Sonnet 5.5
parent a577ff0af3
commit ca43f43e68
4 changed files with 19 additions and 4 deletions
+4 -1
View File
@@ -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": []}
+1 -1
View File
@@ -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):
+12
View File
@@ -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
+2 -2
View File
@@ -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)