Skip to content

Fix model-picker: drop broken readiness_score sort → mac-gate + smallest-first - #2

Merged
kevinqz merged 1 commit into
mainfrom
claude/picker-fix
Jul 4, 2026
Merged

Fix model-picker: drop broken readiness_score sort → mac-gate + smallest-first#2
kevinqz merged 1 commit into
mainfrom
claude/picker-fix

Conversation

@kevinqz

@kevinqz kevinqz commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Problema (achado pelo red-team SotA do readiness_score)

model_dropdown ordenava por readiness_score, mas essa chave nunca é emitida nas entradas do catalog.json (o readiness vive em readiness-scores.json sob score). Resultado: o sort desabava para ordem alfabética e o default pré-selecionado do nó VLM era gemma-4-12b-mm-warshanks (score 48, grade F, experimental) — o 2º menos pronto de 82 modelos. Uma feature "melhor primeiro" entregava o pior.

Fix

  • Hard-gate (_runs_on_this_mac): mantém só modelos utilizáveis neste Mac — artefato available, não not_published, e não explicitamente não-mac. device_support.mac == "unknown" é mantido de propósito (não penaliza entradas da comunidade/fabric, evitando o viés de curadoria que o red-team apontou).
  • Ordena menor-primeiro (_artifact_size_bytes parseia "969MB"/"1.7 GB"): o menor modelo utilizável vira o default — honesto e cego a "qualidade" (que o catálogo não mede).
  • O ComfyUI não lê mais readiness_score → resolve a chave-fantasma pelo lado do leitor (a direção decidida no red-team).

Resultado ao vivo

Default antes Default agora
VLM gemma-4-12b (F, 6.4GB) qwen3-vl-2b (2.3GB)
Depth depth-anything-3-small (54.5MB)
Detection yolox-s (36MB)
Segmentation efficientsam3-tinyvit (374MB)

Testes unitários offline (CI-safe) travando gate + ordenação. ruff limpo · 12/12 testes.

🤖 Generated with Claude Code

…ore sort

A SotA red-team found the ComfyUI dropdown sorted by `readiness_score`, but that
key is never emitted on catalog.json entries — so the sort silently collapsed to
alphabetical and surfaced the LEAST-ready model (gemma-4-12b-mm-warshanks:
F-grade, experimental, needs_review) as the DEFAULT pick in the VLM node.

Replace it: hard-gate to models usable on this Mac (available artifact, not
"not_published", not explicitly non-mac — "unknown" device_support is KEPT so
under-curated/community entries aren't penalized), then sort smallest-first so the
lightest usable model is the honest, capability-blind default. ComfyUI no longer
reads readiness_score at all, resolving the phantom-key dependency (readers stop
expecting a field the catalog doesn't emit per-entry).

Live result: VLM default qwen3-vl-2b (2.3GB), depth depth-anything-3-small (54.5MB),
detection yolox-s (36MB), segmentation efficientsam3-tinyvit (374MB). Adds offline
unit tests locking the gate + ordering. ruff clean, 12/12 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@kevinqz
kevinqz merged commit d8b5651 into main Jul 4, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed02e203cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread comfyui_coreai/catalog.py
match = re.match(r"([\d.]+)\s*([KMGT]?B)\b", raw, re.IGNORECASE)
if not match:
return float("inf")
return float(match.group(1)) * _SIZE_UNITS.get(match.group(2).upper(), 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard malformed artifact sizes while parsing

If a catalog entry that passes _runs_on_this_mac has an artifact_size with a unit but an invalid numeric part, such as 1..2GB or .MB, the regex matches and float(match.group(1)) raises ValueError. Because this runs inside the model_dropdown() sort key, one bad external catalog value would prevent ComfyUI from building the dropdown instead of sorting that unparseable size last as the helper promises.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant