Skip to content

parseModelString returns null for short model ids like "claude-sonnet-5" #234

Description

@axisrow

OS version

macOS (Darwin 25.6.0, arm64)

App version / commit hash

16cc3c8 (upstream/main at time of writing)

Repro steps

import { parseModelString } from './src/shared/utils/modelParser';

parseModelString('claude-sonnet-5'); // → null
parseModelString('claude-opus-5');   // → null

Short model ids of the form claude-{family}-{major} (no minor version, no date suffix) are written into session JSONL logs by some routers/proxies that front the Anthropic API. In the new-format branch the parser requires a 4th part:

if (parts.length < 4) {
  return null;
}

Expected vs actual behavior

Expected: parseModelString('claude-sonnet-5') returns { name: 'sonnet5', family: 'sonnet', majorVersion: 5, minorVersion: null } — the id is a valid model identifier; minor version and date are already optional in every other accepted format.

Actual: returns null, so consumers silently lose model info — model badges show nothing for such sessions and any pricing/cost lookup keyed on parseModelString fails.

Impact

Sessions logged with short model ids lose model attribution across the app (model extraction in EnhancedAIGroup, per-model cost estimates). Happy to send a small PR — the fix is removing the redundant parts.length < 4 guard (2-part input is already rejected above; minorVersion/date parsing already tolerates absence).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions