Repository navigation
fix(parser): apply short model id fix, drop priceFamily stopgap - #13
Merged
Merged
Conversation
claude-{family}-{major} (e.g. "claude-sonnet-5", as written into
session logs by some routers/proxies) was rejected by the new-format
branch, which required a 4th part. parseModelString returned null, so
consumers silently lost model info (model badges, pricing lookups).
The length guard was redundant: 2-part input is already rejected
earlier, and minor version and date remain optional as in other
formats.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Short model ids (claude-sonnet-5) now parse natively after the parser fix, so the local regex fallback is dead code. roundCostUsd resolves the price family via parseModelString directly; the priceFamily export and its test go away — short-id parsing is covered by modelParser tests, short-id pricing by the existing roundCostUsd e2e test. Closes #5 Co-Authored-By: Claude Code <noreply@anthropic.com>
5 tasks done
axisrow
commented
Sep 21, 2026
axisrow
left a comment
Owner
Author
There was a problem hiding this comment.
Approving. Reviewed the diff against origin/main (4 files, +19/-22). The parts.length<4 relaxation is confined to the new-format branch (old format untouched); every parseModelString caller (roundCostUsd, modelExtractor, SubagentItem) null-checks the result, so short ids flipping from null to parsed is exactly the intended fix with no downstream breakage. priceFamily removal is safe: the regex fallback only matched claude-prefixed strings the parser already handles (dead code confirmed), and the removed test assertions are covered by the new parser cases - the non-claude null case pre-exists as gpt-4. Doc comment updated. One non-blocking nit inline. Tests/builds not run from the reviewer checkout.
With the length guard gone, claude-sonnet-20250929 parsed with majorVersion=20250929. An 8-digit parts[2] is a misplaced date, not a version — reject it. Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
Summary
Cherry-picks the parser fix (
9d7bea7, branchfix/parse-short-model-ids) into main and removes thepriceFamily()stopgap fromsrc/cli/analyzeSession.ts—roundCostUsdnow callsparseModelStringdirectly, since short model ids (claude-sonnet-5) parse natively. The regex fallback was dead code.Closes #5. Part of #2 (fork takeover).
Diff
src/shared/utils/modelParser.ts— acceptclaude-{family}-{major}(minor/date stay optional)test/shared/utils/modelParser.test.ts— 2 new parser casessrc/cli/analyzeSession.ts—priceFamily()deleted, directparseModelStringcalltest/main/cli/analyzeSession.test.ts— stopgap test removed (covered by parser tests + e2e pricing test)Net: −22 / +19.
Tests
pnpm typecheck— greenpnpm test— 56 files, 756 tests passedpnpm analyze:sessionon the August short-id session (dd8f991f…, cycle-review):models: claude-sonnet-5,est. cost: $2.49— identical to the stopgap build (verified both), per-round math sums to sonnet rates exactlyFollow-up
Upstream PR matt1398#235 to be closed with "fix carried in fork" comment; branch
fix/parse-short-model-idskept for history.🤖 Generated with Claude Code