Skip to content

Add regression guard for empty default model ids (systemic crash class) #249

Description

@sydneyrenee

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtech-debtCleanup, dead code, migration debt

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions