Skip to content

feat(providers): formalize model discovery modes - #422

Open
Lxr-max wants to merge 1 commit into
OpenCoworkAI:mainfrom
Lxr-max:cursor/provider-model-discovery-modes-2c48
Open

Lxr-max wants to merge 1 commit into
OpenCoworkAI:mainfrom
Lxr-max:cursor/provider-model-discovery-modes-2c48

Conversation

@Lxr-max

@Lxr-max Lxr-max commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Provider model discovery still mostly assumed a listing endpoint, even though real providers split into GET /models, a static catalog, manual IDs, inference-only gateways, and imports with a single known default. This adds a formal modelDiscoveryMode and drives listing, Settings pickers, import defaults, connection tests, and diagnostics from it so “no /models” is no longer a uniform hard failure.

Fixes #210

Mode enum: models | static-hint | manual | infer-only

Mode models:v1:list-for-provider Settings picker Connection test
models GET /models remote select probe /models; 404 + working inference stays degraded
static-hint local modelsHint + defaultModel local select skip /models (ChatGPT Codex OAuth still uses its existing token check)
manual [defaultModel] locally text input skip /models, probe inference → compatible
infer-only same as manual text input skip /models; missing listing is expected, not degraded

Built-in / import defaults:

  • Anthropic, OpenAI, OpenRouter, Ollama → models
  • ChatGPT Codex OAuth → static-hint
  • Claude Code official api.anthropic.commodels; custom/proxy base → infer-only
  • Gemini CLI / OpenCode official maps → models
  • Codex config import → infer-only
  • Custom add form: discovered list → models; listing failed → infer-only; user chose manual → manual

Independent of sibling PRs #419 / #420 / #421; additive types only.

Type of change

  • New feature

Linked issue

Fixes #210

Checklist

  • I checked the linked issue / relevant context before starting
  • pnpm lint && pnpm typecheck && pnpm test passes locally
  • Added/updated tests for the change
  • Added a changeset (pnpm changeset) if user-visible
  • Updated i18n strings for Settings picker + diagnostics copy

Principles 5b

  • Compatible: existing supportsModelsEndpoint / modelsHint still work; modelDiscoveryMode is optional on disk and older configs derive a mode
  • Upgradeable: schemaVersion unchanged; Zod accepts the new optional capability field and locksteps it with listing
  • Lean: no new dependencies; one shared helper module consumed by IPC, Settings, imports, and diagnostics
  • Elegant: listing, picker UX, connection tests, and 404 wording all key off the same mode instead of per-provider fallbacks

Tests

Cover mode helpers, list-for-provider plans, infer-only/manual connection tests (skip /models, success is compatible), Settings picker state, parser payloads, builtin/import stamps, and diagnostics that treat listing 404 as info when the mode does not expect /models.

Screenshots / recordings (UI changes)

Settings picker and custom-provider test copy changed. This environment cannot drive the Electron Settings UI, so those flows were verified with unit tests rather than a live click-through.

Declare modelDiscoveryMode on provider capabilities so listing, Settings
pickers, imports, and diagnostics stop treating GET /models as universal.

Fixes OpenCoworkAI#210
@github-actions github-actions Bot added docs Documentation area:desktop apps/desktop (Electron shell, renderer) labels Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:desktop apps/desktop (Electron shell, renderer) docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: 正式建模模型发现模式 / Formalize provider model discovery modes

1 participant