Repository navigation
feat(ai): discover models from installed tools instead of hand-maintained lists - #1593
Merged
Merged
Conversation
…ined lists Claude models come from the Agent SDK's supportedModels() against the installed claude; Codex models from the app-server model/list. Discovery is lazy (first picker or session), bounded, cached per process, and falls back to one small static list per provider in @plannotator/core/model-catalog. Ask AI and the review / Code Tour / Guided Review launchers now share that one list. Launchers resolve saved picks against it at read time, offer only the efforts (and fast mode) the selected model supports, and default to the opus/sonnet aliases (Claude) and the model Codex marks default. Removes the hand-maintained Claude/Codex launcher catalogs and the Codex rename/retire migrations. core 0.25.6, ui 0.46.0.
…ntext window - resolveModelChoice (core) is now the only resolver: launchers, Ask AI's client and the AI session endpoint all use it. Order: exact id, the alias whose resolvedId covers it, the same family's alias, the surface default, the catalog default. It never moves a pick onto a [1m] id unless the pick was one. - Failed discovery is retried: providers' fetchModels reject on failure and createBestEffortOnce allows a retry after 60s; the client forgets a failed catalog fetch. - Launchers fetch only the selected engine's catalog; viewing a saved guide loads nothing unless it offers Regenerate. - Job cards label models from the discovered catalog; aliases read '<Family> (latest)'; a loading row replaces the empty picker. - Dedupe the deferred-discovery wiring in both ai-runtimes; drop the redundant modelsLoaded flags. - HANDOFF.md lists the ui 0.46.0 breaking export removals.
… replaced Codex pick
- Alias rows name the model they resolve to today ("Opus 5.5 (latest)",
"Sonnet 5 (latest)", "Opus 5.5 1M (latest)"), parsed from the SDK's
resolvedModel by claudeModelVersion (the displayName carries no version);
unparseable ids keep the plain label. Every picker, Ask AI and job cards
read the same catalog label.
- When resolution replaces a saved Codex model with a different one, fast
mode is off: a retired pick saved with fast on no longer launches the
replacement with service_tier=fast.
backnotprop
added a commit
that referenced
this pull request
Sep 22, 2026
…1595) * fix: v0.27.18 QA regressions in PR drafts and discovered model catalogs - review: a comment on a PR whose snapshot the page has not seen (after a reload) posts inline again; only anchor-checked comments get the Outdated label (#1592) - review: restoring a draft after a push no longer re-marks changed files Viewed; the platform-path status post carries draftGeneration - catalog: always offer opus/sonnet/haiku, reading the default row's family and version, so Claude Code 2.1.141 no longer drops Opus (#1593) - settings: Codex Fast/reasoning re-key to the shown model when the saved one was replaced - codex: read fast mode from serviceTiers (priority/fast) - ai: Claude sessions no longer wait on model discovery (Bun + Pi share createDeferredModelDiscovery); capabilities mark modelsSource so the client retries a fallback answer * fix(ai): wait for discovery when the fallback lacks the requested Claude model A first Claude session resolved opus[1m] / claude-fable-5-1[1m] onto the fallback's opus / fable (another context window and billing than later sessions). In session mode the session now waits for discovery when the list is still the fallback and does not offer the pick; picks the fallback offers stay instant. Also stop reading a context size ("Opus 1M context") as the default row's version.
1 task
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.
Problem
The Claude and Codex model lists were maintained by hand and had gone stale. Opus 5.5 (
claude-opus-5-5) and Fable 5.1 (claude-fable-5-1) could not be picked in Ask AI or in the code-review agent launcher. The review default was stillclaude-opus-5. The Codex launchers used their own hand list, which did not includegpt-6-astra, the model Codex currently marks as its default. Claude effort levels were offered for every model, including Haiku, which takes none. Saved launcher choices were never checked, so a stale id was launched anyway.Design
The installed tool supplies the list. Claude's list comes from the Agent SDK's
supportedModels(), run against the user's installedclaude. Codex's list comes from the existing app-servermodel/list. Cursor, OpenCode, Pi, and Copilot were already discovered and are unchanged.Discovery is lazy. Claude discovery sits behind the same deferred provider initializer Codex and OpenCode already use (
/api/ai/capabilities?activate=<id>, or the first session). It never runs at server startup or on page load. It is capped (Claude 10s, Codex 6s) and keeps the fallback list on any failure. A success is kept for the life of the process; a failure may be retried by a later activation after 60s, so a transient failure does not pin the fallback and a broken CLI is not re-spawned on every session. Both Bun and Pi runtimes register it the same way. No new endpoint was added.One list per provider. A single shape,
CatalogModelin@plannotator/core/model-catalog, carries id, label, efforts with a default effort, fast-mode support, andresolvedId. Ask AI and the launchers read the same answer. The launchers get it through the newuseModelCatalogshook, which fetches the same?activate=response for the one engine the launcher is set to, and only when that CLI is installed. Opening the Agents panel set to Claude starts onlyclaude. Viewing a saved guide loads nothing unless the guide is outdated and offers Regenerate. A successful fetch is shared across the page; a failed one is retried the next time a surface asks.The Claude catalog. It is built from
supportedModels(). Alias rows name the model and version they resolve to today: "Opus 5.5 (latest)", "Opus 5.5 1M (latest)", "Sonnet 5 (latest)", "Fable 5.1 (latest)", "Haiku 4.5 (latest)". The version comes from the SDK'sresolvedModel, parsed byclaudeModelVersion(for exampleclaude-haiku-4-5-20251001gives4.5). The SDK'sdisplayNamecarries no version ("Opus (1M context)", "Sonnet" against claude 2.1.280), soresolvedModelis the source. An unparseable or missing id keeps the plain label ("Sonnet (latest)"). Every picker, Ask AI, and the job cards read this same label. Pinned ids keep the model name from the description, marked when they are 1M-context ("Fable 5.1 (1M)"). The SDK'sdefaultrow is dropped because it points at another model rather than being one. A bare latest alias (opus,sonnet,fable,haiku) is added for each family the tool offers, with the same efforts and fast-mode support as that family's first row. The aliases are added so the launcher defaults are always pickable.Defaults come from the tool. Claude review defaults to
opus; tour and guide keepsonnet. Codex surfaces default to'', which means the model Codex's own list marks as default. Ask AI's Claude default issonnet.One resolver for every surface.
resolveModelChoicein core is used by the launchers, by Ask AI's client (aiProvider.ts), and by the AI session endpoint. A saved pick resolves in this order:resolvedIdcovers it (claude-sonnet-5becomessonnet).claude-opus-5orclaude-opus-5-5becomesopus;claude-sonnet-4-6becomessonnet;claude-fable-5becomesfable).A saved Claude pin therefore never silently switches model family. Resolution also never moves a pick onto a
[1m]id unless the pick itself was one:claude-fable-5-1becomesfable, notclaude-fable-5-1[1m]. Saved picks are resolved when read; the cookie is never rewritten. Efforts are clamped to the model's own levels, and a model with no efforts sends none. Fast mode is shown only for models that offer it. When resolution replaces a saved Codex model with a different one, fast mode is turned off: a retired pick saved with fast on does not launch its replacement withservice_tier=fast. A saved''(Codex's own default) is not a replacement, so it keeps fast mode. Claude and Codex launches are disabled until the catalog settles, and a "Loading models…" row replaces the picker meanwhile, so a launch never uses a pick that has not been resolved. The catalog always settles, on the fallback list if discovery fails. Job cards take their model labels from the discovered list.Ask AI Claude effort. Ask AI now forwards the chosen effort to the Claude SDK (
effort). The AI endpoint forwards an effort only when the resolved model lists it.One small fallback per provider. Claude:
opus,sonnet,fable,haiku,claude-fable-5-1,claude-opus-5-5,claude-sonnet-5,claude-haiku-4-5. Codex:gpt-5.6-sol,gpt-5.5.SDK verification (measured before building)
pathToClaudeCodeExecutableset (the AI runtime already passesBun.which("claude")), the list matches the installedclaude2.1.280:opusresolves toclaude-opus-5-5. The SDK's bundled 2.1.260 copy returns an older mapping (claude-opus-5), so using the installed CLI matters.claudeprocess, no prompt, closed after the initialize handshake. It took about 0.5s per run over 3 runs, withsettingSources: []andstrictMcpConfig: true. With default settings it took about 1s and ran the user'sSessionStarthook and loaded MCP servers, which is why discovery passes those two options. The process is gone afterwards (checked withpgrep)..claude.jsonin the Claude config dir, as anyclaudestart does.settingSources: []suppresses user and project settings, but not managed-policy hooks. An enterprise policy hook would still run once per discovery.settings.jsonis not visible to discovery. This is harmless because the ids it returns are aliases, which the Bedrock path already maps.CLAUDE_CONFIG_DIRit returned in about 0.2s. A missing executable fails in milliseconds and keeps the fallback list; a test covers this.default,opus[1m],claude-fable-5-1[1m],sonnet,haiku. I confirmed that the CLI accepts--model opus(givesclaude-opus-5-5),--model claude-fable-5-1, and--model default.model/listtook about 25–470ms and returnedgpt-6-astra(default),gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna, andgpt-5.5. Each entry includes its efforts and default effort, and fast support throughadditionalSpeedTiers.Removed
packages/ui/utils/codexModels.ts: the hand-maintained Codex catalog and its effort ladders.@plannotator/ui0.46.0 export changes for hosts (also listed inpackages/ui/HANDOFF.md):utils/codexModelsremoved (CODEX_MODELS,CODEX_EFFORT_LABELS,codexReasoningOptions,clampCodexReasoning).CLAUDE_MODELS,CLAUDE_EFFORT,TOUR_CLAUDE_MODELS,CODEX_MODELS, andcodexReasoningOptionsremoved fromcomponents/AgentsTab.sanitizeCodexPerModelandmigrateCodexSectionremoved fromhooks/useAgentSettings.DEFAULT_CODEX_MODEL(and the tour/guide Codex defaults) are now'', meaning Codex's own default.DEFAULT_CLAUDE_MODELis now'opus'.AIProviderModelis now an alias ofCatalogModel.RENAMED_CODEX_MODELS/RETIRED_CODEX_MODELSmaps andsanitizeCodexPerModel/migrateCodexSection. Removing them is safe: read-time resolution and effort clamping cover every case they handled (retired or renamed ids fall back to the default;none/minimalefforts clamp to the model's default). Launch is blocked until the catalog settles, so an unresolved value can never reach the CLI.AgentsTab.test.tsand most ofuseAgentSettings.test.ts).Versions:
@plannotator/core0.25.6 (new./model-catalogsubpath),@plannotator/ui0.46.0. The Pi vendor step now copiesmodel-catalog.tsintogenerated/ai/.Test evidence
bash apps/pi-extension/vendor.sh: OKbun run typecheck: cleanbun run --cwd packages/ui smoke:package:@plannotator/[email protected]installs externally with@plannotator/[email protected]bun test(latest commit): 5000 pass, 1186 skip, 0 fail (6186 tests, 539 files)--isolate, 173 files, including the newuseModelCatalogs.dom.test.tsx) 1269 pass, 0 fail; allowlist guard 1 passclaudeModelVersionparses major.minor and ignores date and[1m]suffixes; alias labels match the measured SDK payload; unparseable ids keep the plain label.gpt-5.3-codexwith fast on resolves to GPT-6-Sol, with fast mode off.model/listmappingresolveModelChoice/resolveEffortChoiceclaudekeeps the fallback and does not throwclaude-opus-5-5becomesopus,claude-sonnet-4-6becomessonnet) and never crosses the[1m]boundaryplannotator reviewfrom source (temp data dir, no browser opened):?activate=requests.low.claude-fable-5-1: page load makes no activation requests. Opening Agents (set to Claude) makes exactly one request,?activate=claude-agent-sdk, and no Codex request. The picker shows "Loading models…", then Fable (latest).Risks
claude-opus-5default becomesopus, which is Opus 5.5 today. It never moves to another family or to a 1M-context variant. Only ids with no recognizable family fall back to the surface default.gpt-5.5keepgpt-5.5.resolveSDKModelstill maps family aliases for Ask AI;claude-fable-5-1[1m]has no family env var there and falls back toANTHROPIC_MODEL, as before.@plannotator/core0.25.6 before@plannotator/ui0.46.0.