Repository navigation
config: default models come from a connected provider when OpenRouter cannot answer - #2887
Open
ZeroPoint95 wants to merge 8 commits into
Open
ZeroPoint95 wants to merge 8 commits into
ZeroPoint95 wants to merge 8 commits into
Conversation
… cannot answer Every built-in default (conversation, fallback, reflex and small-work helper tiers, free helper and chat defaults, knowledge) was an OpenRouter id used whatever was connected. With only ChatGPT connected every message failed with "no API key"; with only Ollama the fallback, titles and routing still went to OpenRouter. ReachableDefaultAt keeps a built-in default while a connected service can send it. Otherwise every slot follows the conversation model's provider (a hosted provider before a local one when nothing is chosen): the provider's preferred or strongest model for the conversation, a different strong model for the fallback (none when it offers one), and its lightest model for helpers and knowledge. Strength reads the published intelligence index, then price, then family words, parameter size and thinking levels. With nothing connected the built-in ids stay named, so setup is unchanged. ChatGPT's crew routes now serve the account's remembered models instead of the vendored preferred id alone: an account that no longer lists gpt-5.5 answered the second router look with "not supported when using Codex with a ChatGPT account". Remembered ChatGPT rows keep their thinking levels for ranking only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts for unlisted providers A built-in id that routes to a connected provider by its prefix (deepseek/deepseek-v4.1-flash with a direct DeepSeek account) was kept on routing alone, though that account's own list need not carry it. A provider whose models are known must now list the model; the OpenRouter row and a provider that can say nothing are still trusted on routing. A provider that publishes no model list (Moonshot, MiniMax, Qwen) offered only its preferred model, so every seat used the flagship. It now also offers the model its connection check is sent to, which is small on purpose (Qwen's qwen3.8-flash), and the helper seats take it. Among equally light models the light seat takes the one the provider lists first, its current model, not an older version or a bulkier variant (haiku before claude-haiku-4-5, glm-5.3-flash before glm-5.3-flash[1m]). Adds one table case per shipped provider: DeepSeek, Z.ai coding plan, Moonshot, MiniMax, Qwen, ai&, OpenCode Go, Claude Code and a custom endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pty default, cheaper reads From an impartial review of #2887: - An OpenRouter key now keeps every built-in exactly as it was. With DeepSeek connected directly beside it, a deepseek/ built-in that DeepSeek does not list fell through to choosing among OpenRouter's whole catalog: the fallback went to its most expensive model and helpers to its cheapest. - The talk, fallback and light seats are never empty when the built-in is not: with no models known anywhere the built-in is kept, and with one model the fallback names that model, so a failed reply stays on it instead of letting the catalog suggest a model on a provider nobody connected. - A fallback skips a variant of the conversation model (glm-5.3[1m]) while a different model is offered; a paused plan is chosen only when nothing else is connected; thinking levels use roles.SplitEffort. - The knowledge and fallback settings rows say codeaf's default instead of the OpenRouter model; the legacy nearest-in-the-catalog fallback migrates to the profile's default fallback. - Cost: each service's models are read once per call, the OpenRouter key is checked before any source is resolved, config.Load resolves the default only when CODEAF_MODEL is unset, and the credit check resolves it only once its cheap conditions hold. Measured per call: an OpenRouter profile 91 → 10 allocs (about 41µs → 6µs); ChatGPT + Ollama fallback 298 → 205, reflex 305 → 212. - Manual: the remaining "DeepSeek V4.1 Flash by default" fallback lines, the knowledge row's OpenRouter wording, Claude Code plan limits, paused plans. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g, live terminal fallback From review round 2 of #2887: - Every persisted row carries a plan-pause policy ("wait" or "use pay-as-you-go"), which hostedFirst read as a paused plan, so on a real profile every service ranked alike and a local server listed first won the conversation. The paused rank is gone; a test now builds the profile through ResolveSources (Ollama listed before DeepSeek) and checks every seat. - A published intelligence index or price now counts only when every model in the list carries it; a model whose price is unknown no longer ranks as the cheapest, so a mixed catalog cannot put a flagship in the light seats. - A built-in another connected account lists is no longer taken while the saved conversation model runs on a different provider; the fallback and light seats walk the providers hosted-first after the conversation's own. - The terminal chat's fallback chain was read once at launch. Sessions now take ModelFallbacksNow, which a model client built later (a live switch onto a provider connected with /connect) asks again; one-model runs clear it too. - Doc comments and the settings hint say the conversation model is named when the providers offer only that one; the legacy migration comment names the person's own row; all-caps lead-ins in the new comments are sentences. - Manual: ChatGPT's connect lands on gpt-5.5 only when the account lists it, a crew seat on the plan may use any listed model, one local model shared with the helpers is slower; the paused-plan sentence is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r crew unchanged From review round 3 of #2887: - Provider lists are decoded again only when their cache file changes (recallCached) and each list is filtered and ranked once (rankView). The settings sheet asks for the defaults on every paint and the model-client lock is held while the fallback chain is read. Over a 400-model DeepSeek list plus Ollama: about 1,750 allocations and 2 ms per lookup before, about 100 and 35 µs after. TestUnchangedProviderListsAreReadAndRankedOnce counts decodes and rankings (listReads, listRanks); PERF.md "Default model lookups". - A written model list bumps the settings generation (NoteModelListChanged, ConnectCodex, ConnectClaudeCode, the model shelf and the terminal's connect), so the crew snapshot is rebuilt once a listing lands instead of keeping a helper tier read from a cold list. - With OpenRouter connected, ChatGPT crew routes serve the preferred id alone, as before, and the legacy nearest-in-the-catalog fallback migrates to codeaf's default (DefaultFallbackAt), not to the person's first row entry. - The terminal's settings mark knowledge, fallback models, reflex and small work as changed only when the profile holds a value (FollowsProviders, WrittenAt); comparing against an untouched profile marked them on every profile without OpenRouter. - models.list offers the engine's default as an extra row only when a connected service can send it, so first-run setup cannot save the built-in OpenRouter model while a provider's list is still arriving. - With no saved conversation model, the helpers follow the provider chosen for the conversation; equally light models pass over the conversation model; a provider that names a starting model starts where the picker and the terminal's connect do (Source.PreferredModel), others on their strongest. - Docs: the knowledge hint and manual say the conversation provider's lightest model; ranking signals count only when every model carries them; test comments are sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ZeroPoint95
marked this pull request as ready for review
November 23, 2026 23:53
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.
What
Every built-in default model is an OpenRouter id, and an id with no connected prefix is sent to the always-present OpenRouter row, key or none. So a profile that connected only ChatGPT or only Ollama used models nobody could reach:
no API key: this session has not been given one yet. Afi never replied.Behaviour after this change
config.ReachableDefaultAt(profileDir, slot, builtIn)decides every built-in default:Source.PreferredModel) when it names one; otherwise its strongest model.[1m]; else another provider's talk model; else the conversation model itself, so a failed reply stays on it.qwen3.8-flash).It is applied at the bottom rungs:
ChatDefaultAtModelFallbacksAtfreeTierModelAt: reflex, low, title, router, reply suggestions, free helpersKnowledgeModelAtDefaultFallbackAt: the legacynearest in the catalogmigration insession/agent.goAlso:
gpt-5.5. A ChatGPT account answeredgpt-5.5with HTTP 400 "not supported when using Codex with a ChatGPT account". With OpenRouter connected they serve the preferred id alone, as before.ModelFallbacksNow, so a client built after/connectreads a fallback the new provider can serve. One-model runs clear it, as they clearModelFallbacks.models.listoffers the engine's default as an extra row only when a connected service can send it.Reasoning.Knownstays false).models-and-cost.md,settings.md,what-i-remember.md,app-provider-connections.md),PERF.md"Default model lookups", and the change entry.Self-review: three impartial review-and-repair rounds
Each round was a fresh sub-agent that reviewed the diff against the repo standards and posted nothing.
deepseek/built-in DeepSeek didn't list fell through to OpenRouter's whole catalog, so the fallback went to its most expensive model. Fixed by the OpenRouter early return. Also fixed:ResolveSources.ModelFallbacksNow.models.list. Fixed.Checks run
internal/config/reachable_defaults_test.go:go test ./internal/config/(full package), plus focused runs ofinternal/session,internal/tui3,internal/provider,internal/catalogandcmd/codeaf(models, fallback, knowledge, setup, crew, seats, roles, credits, Codex, one-model, task models, insight, list models): pass.make test-laws,make test-packed-manual manual-gatesandmake changelog-check: pass.TestFactoryWriteUsesJobBaseAcrossAttempts,TestFactoryStepRetryWaitsForPreviousLeaseCleanupandTestFactoryMeasuredOnlyPublicationfail on this machine identically on a cleanorigin/dev. They are pre-existing and out of scope.codex/gpt-6.2-solgpt-5.6-luna, all HTTP 200Known limits, not verified live
claude auth statusreportsloggedIn: false. That is a separate connection issue.gpt-5.5, so the conversation starts there, as the terminal's connect does.Desktop half: Agent-Field/codeaf-desk#888.
🤖 Generated with Claude Code