fix(model-picker): handle list-of-dict models: in provider config - #55770
Closed
iambuddy829-del wants to merge 1 commit into
Closed
fix(model-picker): handle list-of-dict models: in provider config#55770iambuddy829-del wants to merge 1 commit into
iambuddy829-del wants to merge 1 commit into
Conversation
build_models_payload and its downstream consumers (inventory dedup,
_apply_capabilities, _apply_pricing) assume each provider row's `models`
is a list of string ids — they call `m.lower()` and use the ids as dict
keys. But list_authenticated_providers appended user-provider `models:`
list entries verbatim, so a hand-edited config using the `{id, label}`
list form (instead of the dict-keyed-by-id form Hermes writes) put dicts
into the list.
Result: `GET /api/model/options` 500'd with
`AttributeError: 'dict' object has no attribute 'lower'`, leaving the
desktop model picker empty ("Failed to list model options").
Normalize list entries to their id (`id` | `model` | `name`) so `models`
stays a list[str] regardless of which config shape the user wrote.
Verified: build_models_payload(load_picker_context(), …) now returns 41
providers with string model ids and no AttributeError.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Competing/related fix: #33372 (open, earlier) fixes this same |
This was referenced Jul 2, 2026
Contributor
|
Thanks for the focused reproduction and source-level fix. Automated hermes-sweeper review found this is already implemented on current
Closing as superseded by the centralized implementation on main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The desktop model picker was empty with
Error: 500: {"detail":"Failed to list model options"}(Settings → Model and the composer dropdown).GET /api/model/optionswas throwing:Root cause
build_models_payloadand its downstream consumers (inventorydedup,_apply_capabilities,_apply_pricing) all assume each provider row'smodelsis alist[str]of model ids — they callm.lower()and use the ids as dict keys.list_authenticated_providersbuilds user-provider rows fromproviders.<p>.modelsinconfig.yaml. It handles two shapes (per its own comment): the dict-keyed-by-id form Hermes writes, and a plain list-of-strings form. But a hand-edited config using the list-of-{id, label}dicts form:fell into the
listbranch, which appended each entry verbatim — putting dicts intomodels_list, which then blew up every downstreamm.lower()/caps[model].Fix
In the
listbranch, extract the id (id→model→name) from dict entries somodelsstays alist[str]regardless of which config shape the user wrote. Plain-string entries are unchanged.Test plan
build_models_payload(load_picker_context(), include_unconfigured=True, picker_hints=True, canonical_order=True, pricing=True, capabilities=True)→ returns 41 providers, allmodelsare strings, noAttributeErrorcerebras → ['zai-glm-4.7', 'qwen-3-235b-a22b-instruct-2507', 'llama3.1-8b']🤖 Generated with Claude Code