Skip to content

fix: strip parenthetical suffix from model display name - #283

Merged
sirmalloc merged 2 commits into
sirmalloc:mainfrom
CorticalCode:fix/238-model-name-too-long
Apr 8, 2026
Merged

sirmalloc merged 2 commits into
sirmalloc:mainfrom
CorticalCode:fix/238-model-name-too-long

Conversation

@CorticalCode

@CorticalCode CorticalCode commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Strips trailing parenthetical suffix from model display names
  • "Opus 4.6 (1M context)" → "Opus 4.6"
  • "Sonnet 4.6 (200K context)" → "Sonnet 4.6"
  • "Sonnet 4.6" (no parenthetical) → unchanged
  • "Haiku 4.5" → unchanged
  • Works for all current and future models — any (...) suffix is stripped
  • Works for both object-form and legacy string-form model names

Users who want the context window size displayed can add the existing context-length widget to their layout — it already shows 1M, 200K, etc.

Fixes #238

Changes

File Change
src/widgets/Model.ts Added .replace(/\s*\(.*\)$/, '') to strip parenthetical before rendering
src/widgets/__tests__/Model.test.ts 9 new tests: Opus 1M stripping, Sonnet 200K stripping, no-parenthetical passthrough, legacy string, prefix mode, null cases, preview, id fallback

Test Plan

  • bun test — 9 new Model tests pass, no regressions
  • bun run lint — zero errors, zero warnings
  • bun run build — succeeds

🤖 Generated with Claude Code

CorticalCode and others added 2 commits April 4, 2026 04:33
Removes trailing parenthetical (e.g., "(1M context)", "(200K context)")
from model display names. "Opus 4.6 (1M context)" becomes "Opus 4.6".

Users who want the context window size displayed can add the existing
context-length widget to their layout.

Fixes sirmalloc#238

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@sirmalloc
sirmalloc merged commit 67151c6 into sirmalloc:main Apr 8, 2026
@sirmalloc

Copy link
Copy Markdown
Owner

Thanks for this, it will be published in the next release.

pcvelz added a commit to pcvelz/ccstatusline-usage that referenced this pull request Apr 10, 2026
- fix: Fix token overcounting from streaming duplicate JSONL entries (sirmalloc#278)
- fix: strip parenthetical suffix from model display name (sirmalloc#283)
- Version bump, README cleanup

Fork adaptation: Model.ts preserves [1m] suffix while adopting upstream's
general parenthetical-strip regex. Model.test.ts updated to match fork
behavior (ResetTimerWidget depends on [1m] for charged-model detection).
@CorticalCode
CorticalCode deleted the fix/238-model-name-too-long branch April 27, 2026 16:01
tahodev pushed a commit to tahodev/ccstatusline that referenced this pull request Oct 20, 2026
Removes trailing parenthetical (e.g., "(1M context)", "(200K context)")
from model display names. "Opus 4.6 (1M context)" becomes "Opus 4.6".

Users who want the context window size displayed can add the existing
context-length widget to their layout.

Fixes sirmalloc#238

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: Matthew Breedlove <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model name is too long: Opus 4.6 (1M context)

2 participants