Model modality detection is lossy: silent [text] fallback, registry data discarded, unknown strings dropped, no admin override #19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Felix 2026-10-26 (chat: something is wrong with how we detect model modalities). His hunch is right — the detection is verified-broken in four places (live main
5a50635: dispatcher.refresh_catalog -> select_candidates -> admin.py). Facts first, from shipped code:architecture.input_modalitiesis stored as[text](dispatcher.py:738-739) and stays text-only. Metadata-poor gateways (opencode et al., named in the #69 comment directly below) can therefore NEVER be selected for image/audio work, even when the underlying model supports it._resolved_ctx). But_parse_models_devreduces the dump to context ints ONLY; modality data is fetched-and-discarded. Defect 1 is fixable by mirroring the ctx pattern — no new infrastructure.x in text/image/audio/video/file) drops anything else with no log line. A gateway reportingpdfor vision-vocabulary produces a text-only catalog row nobody can notice.ModelPolicyIn(admin.py:132-155) takes designations/rank/excluded/context_window — no modalities. And refresh$sets modalities unconditionally, so even a manual DB fix is erased at the next refresh. Wrong detection + no override + overwrite = admins cannot fix a bad row through any supported path.Forward-looking landmine:
select_candidatesfilters request needs (image/video/audio/file) with$allagainst stored modalities, while unknown-vocabulary models lost their claims at write time. The moment #18 (image inputs) lands real multipart traffic, misclassified models will produce all-candidates-failed proxy errors that LOOK like provider outages but are catalog defects. Fix classification before opening the input path.Suggested scope (his to decide): registry modality fallback mirroring ctx; loud log for dropped modality strings; a
modalities_overridepolicy field honored across refreshes (like ctx: provider value wins unless an explicit override exists); a doc note on vocabulary mapping per gateway. — rosa (filing, not deciding)CONFIRMED with live data (Felix 17:59: opencode and qwen coding plan all text-only in our list). Just fetched https://models.dev/api.json with 232 providers and traced the why:
Two facts the fix must respect, found in the same dump:
(a) Three-way vocabulary mismatch: the registry says pdf, our whitelist drops it (defect 3 now has a live example), and detect_needs maps attachments to file. Fallback without pdf/file normalization would still mis-select; normalization lands in the same change.
(b) Host collision: opencode and opencode-go share api host opencode.ai - the docstring already notes they disagree on three ids for ctx, first-writer-wins. A host-keyed modality slot would silently mix the two plans claims: a false capability claim, worse than the mild ctx case. Key modality slots by plan path segment, e.g. /inference/go/, not bare host.
Impact restated once: about 70 percent of the opencode catalog, including our free-tier fallback models, is mislabeled text-only today. Harmless only because nothing can send images yet - decisive when #18 lands, actively misleading during any multipart debugging. The fix is small: parse modalities in _parse_models_dev, registry fallback in refresh, pdf/file normalization, path-keyed slots - all testable OFFLINE against the same api.json dump. Priority argument for the board. - rosa