Skip to content

fix(ai-settings): test a Claude Code route under its own slug - #5993

Open
Guykaganovsky1 wants to merge 2 commits into
tinyhumansai:mainfrom
Guykaganovsky1:fix/custom-routing-test-slug
Open

fix(ai-settings): test a Claude Code route under its own slug#5993
Guykaganovsky1 wants to merge 2 commits into
tinyhumansai:mainfrom
Guykaganovsky1:fix/custom-routing-test-slug

Conversation

@Guykaganovsky1

@Guykaganovsky1 Guykaganovsky1 commented Sep 3, 2026

Copy link
Copy Markdown

Summary

  • Pressing Test on a Claude Code route in Settings → AI → Custom routing sent the wrong provider slug: ollama:<model> instead of claude-code:<model>.
  • The call therefore asked Ollama for a model it has never heard of (e.g. ollama:claude-fable-5-1), while the failure banner named claude-code as the provider that rejected it — pointing the user at the wrong thing to fix.
  • The test string now reuses registrySlug, which already mapped all three source kinds correctly, so the test call names the same slug the save persists.
  • Adds a regression test for the claude-code case plus the cloud case that must keep working.

Problem

CustomRoutingDialog derived two slugs independently. registrySlug (used for the per-model vision flag) handled all three kinds — cloud → its own slug, local → ollama, claude-code → claude-code. currentProviderString (used for the test call) had only a cloud branch and an else, and the else assumed local:

source.kind === 'cloud'
  ? `${source.providerSlug}:${model}`
  : `ollama:${model}`      // ← claude-code lands here

A saved Claude Code route is fine — handleSave has a proper claude-code branch — so the route works while its own Test button reports it as broken. That is the worst shape for this bug: the diagnostic tool is the only thing lying.

Solution

Derive the test string from registrySlug, the mapping that was already correct, and bail out when it is null (the managed source, which has nothing to test against). Local routes are unchanged: registrySlug yields ollama for them exactly as the old else-branch did.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) — new app/src/components/settings/panels/ai/__tests__/CustomRoutingDialog.test.tsx: the claude-code case (the regression) and the cloud case (the path that must not change).
  • Diff coverage ≥ 80% — the changed lines are the provider-string expression, executed by both new tests.
  • Coverage matrix updated — N/A: bug fix to existing behaviour, no feature row added, removed or renamed
  • All affected feature IDs from the matrix are listed under ## RelatedN/A: no matrix feature row covers this dialog's test button
  • No new external network dependencies introduced — the test mocks testProviderModel; no network.
  • Manual smoke checklist updated if this touches release-cut surfaces — N/A: no release-cut surface changes
  • Linked issue closed via Closes #NNNN/A: no filed issue; found while wiring the Claude Code CLI provider

Impact

Desktop UI only, one expression in one dialog. No runtime, RPC, config or persistence change; nothing about how a route is saved or resolved moves. The user-visible effect is that Test now exercises the route the user selected.

Related

N/A — no linked issue.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed provider testing for Claude Code routes so requests use the correct Claude Code provider instead of being treated as local Ollama models.
    • Preserved correct provider handling for cloud-based routes.
  • Tests

    • Added coverage for testing Claude Code and cloud provider routes through the custom routing settings dialog.

The custom-routing dialog built its test-call provider string as
`ollama:<model>` for every non-cloud source, so pressing Test on a Claude Code
route asked Ollama for a model it has never heard of — `ollama:claude-fable-5-1`
— while the failure banner named claude-code as the provider that rejected it.

`registrySlug`, three lines above, already mapped the three source kinds
correctly (cloud → its slug, local → ollama, claude-code → claude-code). The
test string now reuses it, so the call names the same slug the save persists.
Local routes are unaffected: `registrySlug` yields `ollama` for them, exactly as
before.

Adds a regression test covering both the claude-code and the cloud case.
@Guykaganovsky1
Guykaganovsky1 requested a review from a team September 3, 2026 05:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T05:36:24.590503Z 2be4edd PR opened
🔒 Security Review Completed 2026-09-03T05:38:49.859495Z 2be4edd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out

@tinysweeper

tinysweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown

How this change flows

1 changed behaviour across 10 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 39 further behaviours left out to keep the diagram readable.

flowchart LR
  n0["CustomRoutingDialog<br/>changed"]:::changed
  n1["ProviderModelPickerDialog"]:::impacted
  n2["handleTest"]:::impacted
  n3["GlobalOwnModelSelector"]:::impacted
  n4["CustomDialogSource"]:::impacted
  n5["AIPanel"]:::impacted
  n6["currentProviderString"]:::impacted
  n0 -->|uses| n1
  n0 -->|calls| n2
  n0 -->|uses| n4
  n0 -->|uses| n6
  n1 -->|uses| n4
  n2 -->|uses| n6
  n3 -->|uses| n1
  n3 -->|uses| n4
  n5 -->|uses| n0
  n5 -->|uses| n3
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading

Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge.

tinysweeper 0.1.0

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Sep 3, 2026
@coderabbitai

coderabbitai Bot commented Sep 3, 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: Team

Run ID: 0a9982e6-6b6e-4dfe-8a1d-7628daa50eec

📥 Commits

Reviewing files that changed from the base of the PR and between 2be4edd and 7e15155.

📒 Files selected for processing (1)
  • app/src/components/settings/panels/ai/__tests__/CustomRoutingDialog.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/components/settings/panels/ai/tests/CustomRoutingDialog.test.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

CustomRoutingDialog now uses registrySlug when testing routes. New tests verify provider strings for Claude Code and cloud providers.

Changes

Provider routing

Layer / File(s) Summary
Use registry provider slugs
app/src/components/settings/panels/ai/CustomRoutingDialog.tsx
currentProviderString now uses registrySlug instead of treating every non-cloud route as Ollama.
Validate provider test strings
app/src/components/settings/panels/ai/__tests__/CustomRoutingDialog.test.tsx
Tests mock testProviderModel and verify Claude Code and cloud provider strings.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 7e151

The Test action now uses the provider registry slug so Claude Code routes are tested through the correct provider, with regression coverage for Claude Code and cloud routes. No concrete merge-blocking risk remains.

Poem

A rabbit checks each route with care
Claude uses its own slug there
Cloud keeps its provider name
Tests confirm the routing frame
Green results fill the air

🚥 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 and concisely describes the main change: fixing Claude Code route testing to use its own provider slug.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.

Warning

Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice.


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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant