Skip to content

revert(web): revert web search button fix - #2221

Merged
smakosh merged 1 commit into
mainfrom
revert-2216-fix/web-search-issue
May 9, 2026
Merged

smakosh merged 1 commit into
mainfrom
revert-2216-fix/web-search-issue

Conversation

@smakosh

@smakosh smakosh commented May 9, 2026 •

Copy link
Copy Markdown
Member

Reverts #2216

Summary by CodeRabbit

  • Refactor
    • Refined how the system determines which models support reasoning and web search capabilities through an improved lookup mechanism.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The PR refactors model capability detection by moving reasoning and web-search support checks from stored object fields to a mappings-based lookup system. The type contract removes these fields, the model mapping function stops generating them, and the chat page implements a new lookup pattern using ApiModelProviderMapping.

Changes

Capability Lookup Refactoring

Layer / File(s) Summary
Type Contract
apps/playground/src/lib/types.ts
ComboboxModel interface removes optional reasoning and webSearch capability fields.
Model Mapping Transformation
apps/playground/src/lib/mapmodels.ts
Root and per-mapping entries no longer include reasoning/webSearch fields; combobox entry ID format changes to always use ${providerId}/${modelId}.
Chat Page Capability Checks
apps/playground/src/components/playground/chat-page-client.tsx
Primary page and ExtraChatPanel parse selectedModel, resolve the model definition, and derive reasoning/web-search support from ApiModelProviderMapping instead of availableModels.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • theopenco/llmgateway#2216: Related refactoring of model capability flags in chat-page-client and model mapping logic; one PR removes the flags while the other modifies their handling.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title 'revert(web): revert web search button fix' directly describes the PR's primary purpose—reverting a web search button fix. It is clear, specific, and accurately reflects the changeset contents.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-2216-fix/web-search-issue

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 and usage tips.

@smakosh smakosh changed the title Revert "fix: web search button not showing for models with web search capability" revert: "fix: web search button not showing for models with web search capability" May 9, 2026

@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

🧹 Nitpick comments (1)
apps/playground/src/lib/mapmodels.ts (1)

42-50: ⚡ Quick win

Remove speculative/stale inline notes around ID construction.

The block at Line 42–Line 50 reads like review discussion and contradicts the final implementation at Line 53, which makes future maintenance harder. Please replace it with a short factual comment (or remove it).

As per coding guidelines, "No unnecessary code comments".

🤖 Prompt for 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.

In `@apps/playground/src/lib/mapmodels.ts` around lines 42 - 50, Remove the
speculative/stale discussion block about ID construction in mapModels and
replace it with a short factual comment: state that the function constructs IDs
using provider-specific p.modelName (not Gateway m.id) to preserve current
behavior and compatibility with ModelSelector expectations, or omit the comment
entirely; update references to the symbols mapModels, p.modelName, and m.id so
the remaining comment clearly reflects the actual implementation without the
historical debate.
🤖 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 `@apps/playground/src/components/playground/chat-page-client.tsx`:
- Around line 368-370: selectedModel is being split with
selectedModel.split("/") and destructured into [providerId, modelId], which
truncates modelId when it contains additional slashes; update parsing to split
only on the first slash by finding the first index (e.g., idx =
selectedModel.indexOf("/")) and set providerId = selectedModel.slice(0, idx) and
modelId = selectedModel.slice(idx + 1) (falling back to "" or selectedModel when
no slash). Apply this fix for every occurrence where you currently do const
[providerId, modelId] = selectedModel.includes("/") ? (selectedModel.split("/")
as [string, string]) : ["", selectedModel]; (the selectedModel parsing sites in
chat-page-client.tsx) so capability detection uses the full remainder of the
modelId.

---

Nitpick comments:
In `@apps/playground/src/lib/mapmodels.ts`:
- Around line 42-50: Remove the speculative/stale discussion block about ID
construction in mapModels and replace it with a short factual comment: state
that the function constructs IDs using provider-specific p.modelName (not
Gateway m.id) to preserve current behavior and compatibility with ModelSelector
expectations, or omit the comment entirely; update references to the symbols
mapModels, p.modelName, and m.id so the remaining comment clearly reflects the
actual implementation without the historical debate.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dc9eb69d-1b9b-4416-a03e-ffb546147b7d

📥 Commits

Reviewing files that changed from the base of the PR and between b4438d2 and 0162901.

📒 Files selected for processing (3)
  • apps/playground/src/components/playground/chat-page-client.tsx
  • apps/playground/src/lib/mapmodels.ts
  • apps/playground/src/lib/types.ts
💤 Files with no reviewable changes (1)
  • apps/playground/src/lib/types.ts

Comment on lines +368 to +370
const [providerId, modelId] = selectedModel.includes("/")
? (selectedModel.split("/") as [string, string])
: ["", selectedModel];

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix selected-model parsing to handle model IDs that contain /.

At Line 368/388 (and mirrored at Line 1341/1361), selectedModel.split("/") is destructured as [providerId, modelId]. If modelId contains additional slashes, modelId is truncated, so capability detection can silently fail.

Use first-slash parsing instead (providerId = prefix, modelId = rest).

Suggested patch
-const [providerId, modelId] = selectedModel.includes("/")
-	? (selectedModel.split("/") as [string, string])
-	: ["", selectedModel];
+const slash = selectedModel.indexOf("/");
+const providerId = slash === -1 ? "" : selectedModel.slice(0, slash);
+const modelId = slash === -1 ? selectedModel : selectedModel.slice(slash + 1);

Also applies to: 388-390, 1341-1343, 1361-1363

🤖 Prompt for 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.

In `@apps/playground/src/components/playground/chat-page-client.tsx` around lines
368 - 370, selectedModel is being split with selectedModel.split("/") and
destructured into [providerId, modelId], which truncates modelId when it
contains additional slashes; update parsing to split only on the first slash by
finding the first index (e.g., idx = selectedModel.indexOf("/")) and set
providerId = selectedModel.slice(0, idx) and modelId = selectedModel.slice(idx +
1) (falling back to "" or selectedModel when no slash). Apply this fix for every
occurrence where you currently do const [providerId, modelId] =
selectedModel.includes("/") ? (selectedModel.split("/") as [string, string]) :
["", selectedModel]; (the selectedModel parsing sites in chat-page-client.tsx)
so capability detection uses the full remainder of the modelId.

@github-actions github-actions Bot changed the title revert: "fix: web search button not showing for models with web search capability" revert(web): revert fix for web search button May 9, 2026
@smakosh
smakosh enabled auto-merge May 9, 2026 10:05
@github-actions github-actions Bot changed the title revert(web): revert fix for web search button revert(web): revert web search button fix May 9, 2026
@smakosh
smakosh added this pull request to the merge queue May 9, 2026
Merged via the queue into main with commit 92de4a2 May 9, 2026
13 of 14 checks passed
@smakosh
smakosh deleted the revert-2216-fix/web-search-issue branch May 9, 2026 10:19
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