Skip to content

Fixed model list showing garbled names with 1M-context /model menu format - #108

Merged
oleg68 merged 1 commit into
nbplugins:mainfrom
oleg68:bugfix/model-list-garbled-1m-context
May 7, 2026
Merged

oleg68 merged 1 commit into
nbplugins:mainfrom
oleg68:bugfix/model-list-garbled-1m-context

Conversation

@oleg68

@oleg68 oleg68 commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • ModelMenuParser is now always the primary extractor in discoverModels(), replacing the hand-rolled descPat regex that was applied to ChoiceMenuModel options
  • The old descPat path is kept as a fallback for formats ModelMenuParser does not recognise
  • Added fixture test format1-with-1m-context covering the 5-option menu with 1M-context variants, cost annotations, wrapped lines, and footer text

Root cause: When the /model menu was detected by detectChoiceMenu first, the if (menuOpt.isPresent()) branch used a less-robust regex against ChoiceMenuModel.Option.display() values. This produced garbled names like "Mtoket 4.6 with 1M context" and "Haiku44.5" with the new claude-code menu format.

Test plan

  • All 729 unit tests pass (mvn test)
  • Open a Claude Code session → click the model combo → verify it shows: Sonnet 4.6, Sonnet 4.6 with 1M context, Opus 4.7, Opus 4.7 with 1M context, Haiku 4.5
  • No spurious ChoiceMenuPanel with "model names, specify with --model." appears during discovery

🤖 Generated with Claude Code

ModelMenuParser is now always the primary extractor in discoverModels().
The hand-rolled descPat approach (applied to ChoiceMenuModel options) is
kept as a fallback only. This fixes garbled names like "Mtoket 4.6 with
1M context" caused by the new /model menu format that includes 1M-context
variants and cost annotations (e.g. · $3/$15 per Mtok).

Added fixture test case format1-with-1m-context to ModelMenuParserTest
covering the full 5-option menu with wrapped lines and footer text.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@oleg68
oleg68 merged commit 6334a6e into nbplugins:main May 7, 2026
3 checks passed
@oleg68
oleg68 deleted the bugfix/model-list-garbled-1m-context branch May 7, 2026 14:39
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.

1 participant