Several *DefaultModelId constants in src/shared/api.ts were hardcoded to "" as …ModelId. With an empty default, getModel() resolves models[""] === undefined, and getModelParams() then throws Cannot read properties of undefined (reading "maxTokens") for any unknown/unset model — a latent crash hidden by missing tests.
Fixed for all static-map providers (anthropic, bedrock, deepseek, gemini, vertex → real defaults; mistral → codestral-latest; openai-native → gpt-4o). The Vertex constructor was also rejecting unconfigured handlers (Unknown model ID: ) and now applies the default. Dynamic gateways (glama/requesty/openrouter/unbound) intentionally keep "" because model info is supplied separately.
Ask
- Add a guard so this cannot regress: a unit test asserting every static provider
getModel() (no apiModelId) returns non-undefined info with a numeric contextWindow, and/or an assertion that static-map *DefaultModelId values are keys of their model map.
Acceptance
- A failing test if any static-map default model id is empty/invalid.
Several
*DefaultModelIdconstants insrc/shared/api.tswere hardcoded to"" as …ModelId. With an empty default,getModel()resolvesmodels[""] === undefined, andgetModelParams()then throwsCannot read properties of undefined (reading "maxTokens")for any unknown/unset model — a latent crash hidden by missing tests.Fixed for all static-map providers (anthropic, bedrock, deepseek, gemini, vertex → real defaults; mistral →
codestral-latest; openai-native →gpt-4o). The Vertex constructor was also rejecting unconfigured handlers (Unknown model ID:) and now applies the default. Dynamic gateways (glama/requesty/openrouter/unbound) intentionally keep""because model info is supplied separately.Ask
getModel()(noapiModelId) returns non-undefinedinfowith a numericcontextWindow, and/or an assertion that static-map*DefaultModelIdvalues are keys of their model map.Acceptance