Skip to content

fix(app): show config-declared models in the picker by default - #53158

Closed
supermwl wants to merge 1 commit into
anomalyco:devfrom
supermwl:oc/fix-custom-models-visible
Closed

supermwl wants to merge 1 commit into
anomalyco:devfrom
supermwl:oc/fix-custom-models-visible

Conversation

@supermwl

@supermwl supermwl commented Oct 4, 2026

Copy link
Copy Markdown

Summary

Models explicitly declared in the user's config (provider.<id>.models) are hidden from the web/Desktop model picker unless they happen to be the latest release of their family. The user added them on purpose — they should be visible by default.

Repro (measured on 1.18.32 Desktop): config declares openrouter → z-ai/glm-5.3 (limit + cost). The model is listed by the CLI and served by the runtime, but the picker hides it: its family glm has a newer release (z-ai/glm-5.3-prime, 2026-09-23 vs 2026-08-14), so latestSet doesn't include it and visible() returns false. The user sees "GLM 5.3 Prime" and "GLM Flash" under OpenRouter, but not the model they explicitly configured.

Root cause

visible() in packages/app/src/context/models.tsx:

const visible = (model: ModelKey) => {
  const state = visibility().get(key)
  if (state === "hide") return false
  if (state === "show") return true
  if (latestSet().has(key)) return true   // only the newest per family
  const date = release().get(key)
  if (!date?.isValid) return true
  return false                            // ← config-declared, non-latest models die here
}

Same visible()/latestSet logic reported in #49605 (config-declared models hidden via the released: 0 → "1970-01-01" coercion) and #47557 (family-less catalog models dropped by groupBy). This PR fixes the config-declared variant: a model the user explicitly declared in their config should not depend on release-date heuristics to be visible.

Change

  • New pure helper customModelKeysFromConfig(config) in packages/app/src/context/model-keys.ts — extracts providerID:modelID keys from config.provider.<id>.models (defensive against missing/invalid shapes).
  • ModelsProvider now consumes serverSync().data.config (already available in the store) and visible() returns true for config-declared models after user preferences (show/hide still win) and before the latestSet heuristic.
  • No core/server changes; no schema changes.

Behavior after

Model Before After
config-declared, non-latest (e.g. z-ai/glm-5.3) hidden visible
config-declared + user "hide" hidden hidden (preference wins)
catalog, latest of family visible visible
catalog, non-latest, valid release date hidden hidden (unchanged)

Testing

  • New packages/app/src/context/models.test.ts (7 cases) covering the extraction helper: typical config, empty/null/undefined config, providers without models, non-object models, multiple providers.
  • bun turbo typecheck: 30/30 packages pass.
  • Manual verification path: declare a non-latest model in provider.<id>.models, restart, confirm it appears in the picker and in "Manage models" (toggle born checked); toggling it off still hides it.

Notes

…ault

Models explicitly declared in the user's config (provider.<id>.models) were
hidden from the web/Desktop model picker unless they happened to be the
latest release of their family. The user added them on purpose — they should
be visible by default, with user show/hide preferences still taking
precedence.

Fixes the config-declared variant of #49605; related to #47557 (same
visible()/latestSet logic).
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@supermwl

supermwl commented Oct 4, 2026

Copy link
Copy Markdown
Author

Closing at author's request.

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

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant