Skip to content

Conversation

@mrm007
Copy link

@mrm007 mrm007 commented Feb 8, 2026

Summary

  • Generalize normalizeModelName in model-availability.ts to handle all claude version numbers, not just 4.5
  • Collapse two regex replacements into one using [.-] character class
  • Add tests for cross-provider model matching and non-claude safety

Problem

models.dev uses different version separators per provider for the same model:

  • anthropicclaude-opus-4-6 (hyphens)
  • github-copilotclaude-opus-4.6 (dots)

The fallback chains include github-copilot as a provider alongside anthropic, but fuzzyMatchModel only normalized 4-54.5. All other versions (4-6, 4-0, 4-1) silently failed to match, causing fallback chains to skip copilot entirely and land on lower-quality free models.

Changes

src/shared/model-availability.ts — Replace two hardcoded 4-5 regexes with one generic pattern:

// Before
.replace(/claude-(opus|sonnet|haiku)-4-5/g, "claude-$1-4.5")
.replace(/claude-(opus|sonnet|haiku)-4\.5/g, "claude-$1-4.5")

// After
.replace(/claude-(opus|sonnet|haiku)-(\d+)[.-](\d+)/g, "claude-$1-$2.$3")

src/shared/model-availability.test.ts — 2 new tests:

  1. Cross-provider matching: claude-opus-4-6 matches github-copilot/claude-opus-4.6
  2. Safety: non-claude hyphens (grok-code-fast-1) are not affected

Testing

All 50 tests pass locally (bun test src/shared/model-availability.test.ts).

Closes #1679

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@mrm007
Copy link
Author

mrm007 commented Feb 8, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Feb 8, 2026
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@mrm007 mrm007 force-pushed the fix/cross-provider-claude-model-normalization branch from e6be08d to 1f9097b Compare February 8, 2026 21:44
…chModel

models.dev uses different version separators per provider (anthropic: claude-opus-4-6, github-copilot: claude-opus-4.6). The existing normalizeModelName only handled 4.5 — generalize the regex to handle any version number.

Fixes: code-yeongyu#1679
@mrm007 mrm007 force-pushed the fix/cross-provider-claude-model-normalization branch from 1f9097b to 2ee16da Compare February 8, 2026 21:51
marlon-costa-dc pushed a commit to marlon-costa-dc/oh-my-opencode that referenced this pull request Feb 9, 2026
marlon-costa-dc pushed a commit to marlon-costa-dc/oh-my-opencode that referenced this pull request Feb 9, 2026
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.

[Bug]: Fallback chains silently skip github-copilot — model IDs don't match copilot's catalog

1 participant