Skip to content

fix: drop displayName from getLanguageModelKey to fix MCP model selection#1408

Open
salarkhannn wants to merge 2 commits into
sourcebot-dev:mainfrom
salarkhannn:fix/mcp-language-model-key
Open

fix: drop displayName from getLanguageModelKey to fix MCP model selection#1408
salarkhannn wants to merge 2 commits into
sourcebot-dev:mainfrom
salarkhannn:fix/mcp-language-model-key

Conversation

@salarkhannn

@salarkhannn salarkhannn commented Jul 1, 2026

Copy link
Copy Markdown

Fixes #1137

getLanguageModelKey included displayName in the model key, but displayName is a cosmetic label, not an identity field. The MCP schema only exposes {provider, model}, so explicit model selection via the ask_codebase tool always produced a key mismatch.

Dropping displayName from the key fixes the MCP path at the root and prevents the same bug pattern from appearing in other callers.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed a “Language model not configured” error when an explicit model is selected.
    • Updated model matching to use only provider + model (removed the extra name component), ensuring the chat tool selects the correct configuration consistently.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7554f89b-ab30-4caa-83b6-a7ece3d61b86

📥 Commits

Reviewing files that changed from the base of the PR and between f6bf02b and 3719f83.

📒 Files selected for processing (1)
  • CHANGELOG.md
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Walkthrough

This change updates getLanguageModelKey to use only provider and model for matching, and adds a changelog note describing the MCP ask_codebase fix.

Changes

Language model key fix

Layer / File(s) Summary
Match key generation
packages/web/src/features/chat/utils.ts
getLanguageModelKey now accepts only provider and model, and returns ${provider}-${model} instead of including displayName.
Changelog entry
CHANGELOG.md
Adds an Unreleased fixed note describing the model-matching change and the resolved 400 Language model not configured error.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

  • sourcebot-dev/sourcebot#1372 — also changes getLanguageModelKey-related typing/identity handling in packages/web/src/features/chat/utils.ts.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: dropping displayName from getLanguageModelKey to fix MCP model selection.
Linked Issues check ✅ Passed The code change matches the linked issue by keying language models on provider and model only, which should unblock explicit MCP selection.
Out of Scope Changes check ✅ Passed The only changes are the targeted key-format fix and a changelog note, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Line 30: The CHANGELOG entry is linking to the originating issue instead of
the pull request. Update the markdown link in the release note entry to use the
PR id in the same `[#<id>](<url>)` format as the other entries, and keep the
text associated with the `getLanguageModelKey` change unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 761e4946-6550-4460-8115-bb079acb29e7

📥 Commits

Reviewing files that changed from the base of the PR and between 3e4548c and f6bf02b.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • packages/web/src/features/chat/utils.ts

Comment thread CHANGELOG.md Outdated
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.

MCP ask_codebase rejects explicit languageModel: getLanguageModelKey includes displayName which the MCP schema doesn't expose

1 participant