Skip to content

fix(models): add fuzzy matching to getModel() for auto-synced aliases#179

Merged
PetrAnto merged 1 commit intomainfrom
claude/review-model-sync-gVjuw
Feb 24, 2026
Merged

fix(models): add fuzzy matching to getModel() for auto-synced aliases#179
PetrAnto merged 1 commit intomainfrom
claude/review-model-sync-gVjuw

Conversation

@PetrAnto
Copy link
Owner

After /syncall, auto-synced models get hyphenated aliases like "claude-sonnet-46" but users try "sonnet46" or "claudesonnet". getModel() only did exact key lookups, so these all failed.

Added fuzzy fallback with 4 passes:

  1. Normalized exact (strip hyphens/dots)
  2. Suffix match ("sonnet46" → "claude-sonnet-46")
  3. Prefix match ("claudesonnet" → "claude-sonnet-46")
  4. Model ID match ("gpt4o" → openai/gpt-4o)

Also stores canonical alias in /use handler so subsequent lookups are always exact matches.

https://claude.ai/code/session_01K2mQTABDGY7DnnposPdDjw

After /syncall, auto-synced models get hyphenated aliases like
"claude-sonnet-46" but users try "sonnet46" or "claudesonnet".
getModel() only did exact key lookups, so these all failed.

Added fuzzy fallback with 4 passes:
1. Normalized exact (strip hyphens/dots)
2. Suffix match ("sonnet46" → "claude-sonnet-46")
3. Prefix match ("claudesonnet" → "claude-sonnet-46")
4. Model ID match ("gpt4o" → openai/gpt-4o)

Also stores canonical alias in /use handler so subsequent lookups
are always exact matches.

https://claude.ai/code/session_01K2mQTABDGY7DnnposPdDjw
@PetrAnto PetrAnto merged commit 1474ef3 into main Feb 24, 2026
0 of 5 checks passed
@github-actions
Copy link

E2E Test Recording (workers-ai)

❌ Tests failed

E2E Test Video

@github-actions
Copy link

E2E Test Recording (base)

❌ Tests failed

E2E Test Video

@github-actions
Copy link

E2E Test Recording (discord)

❌ Tests failed

E2E Test Video

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.

2 participants