Skip to content

fix(routing): use fully qualified Anthropic model ID#592

Open
marcmantei wants to merge 2 commits into
spacedriveapp:mainfrom
marcmantei:fix/default-anthropic-model-id
Open

fix(routing): use fully qualified Anthropic model ID#592
marcmantei wants to merge 2 commits into
spacedriveapp:mainfrom
marcmantei:fix/default-anthropic-model-id

Conversation

@marcmantei
Copy link
Copy Markdown

Summary

  • The default routing model "anthropic/claude-sonnet-4" is not a valid model identifier
  • The Anthropic API requires the fully qualified ID with date suffix: "anthropic/claude-sonnet-4-20250514"
  • This especially affects OAuth users where the short alias is not resolved

Changes

  • src/llm/routing.rs: Update both default model references to use fully qualified ID

Test plan

  • Verify default model routing works with API key auth
  • Verify default model routing works with OAuth auth
  • Verify model selection in Settings UI shows correct model

🤖 Generated with Claude Code
via Happy

The default routing model "anthropic/claude-sonnet-4" is not a valid
model identifier for the Anthropic API. This causes failures when
using OAuth authentication (Claude Pro/Max subscription) since the
API requires the fully qualified model ID with date suffix.

Changes both the Default impl and defaults_for_provider to use
"anthropic/claude-sonnet-4-20250514".

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

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: c26faf03-e434-4477-bd9a-a650778a0bc9

📥 Commits

Reviewing files that changed from the base of the PR and between 37f815f and 836ee6a.

📒 Files selected for processing (1)
  • src/llm/routing.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/llm/routing.rs

Walkthrough

The default Anthropic model for routing is updated from the unversioned anthropic/claude-sonnet-4 to the dated release anthropic/claude-sonnet-4-20250514 in both RoutingConfig::default() and the defaults_for_provider() function. No routing logic or fallback behavior is changed.

Changes

Anthropic Model Version Bump

Layer / File(s) Summary
Default Model Configuration
src/llm/routing.rs
RoutingConfig::default() and defaults_for_provider("anthropic") both use versioned model string anthropic/claude-sonnet-4-20250514 via a new DEFAULT_ANTHROPIC_MODEL constant and RoutingConfig::for_model(...).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • spacedriveapp/spacebot#197: Both PRs affect Anthropic model routing—this PR updates the default model version in routing constants while that PR adds environment variable overrides for Anthropic model selection.

Suggested reviewers

  • jamiepine
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(routing): use fully qualified Anthropic model ID' directly describes the main change—updating the routing model to use a fully qualified model ID instead of an unversioned identifier.
Description check ✅ Passed The description explains the problem (unversioned model ID is invalid), the solution (use fully qualified ID with date suffix), and provides test verification steps—all directly related to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

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

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/llm/routing.rs (1)

39-39: ⚡ Quick win

Centralize the Anthropic default model ID in a constant.

This string is now duplicated in multiple default paths; extracting a single constant will prevent future drift when the dated model ID is bumped again.

♻️ Suggested refactor
+const DEFAULT_ANTHROPIC_MODEL: &str = "anthropic/claude-sonnet-4-20250514";
+
 impl Default for RoutingConfig {
     fn default() -> Self {
-        Self::for_model("anthropic/claude-sonnet-4-20250514".into())
+        Self::for_model(DEFAULT_ANTHROPIC_MODEL.into())
     }
 }
@@
-        "anthropic" => RoutingConfig::for_model("anthropic/claude-sonnet-4-20250514".into()),
+        "anthropic" => RoutingConfig::for_model(DEFAULT_ANTHROPIC_MODEL.into()),

Also applies to: 167-167

🤖 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 `@src/llm/routing.rs` at line 39, Extract the Anthropic default model ID
literal into a single constant (e.g. ANTHROPIC_DEFAULT_MODEL: &str =
"anthropic/claude-sonnet-4-20250514") and replace all duplicated string
occurrences (such as in the
Self::for_model("anthropic/claude-sonnet-4-20250514".into()) call and the other
occurrence around line 167) with ANTHROPIC_DEFAULT_MODEL (use .into() where
needed). Add the const near the top of routing.rs (module scope) so functions
like the referenced Self::for_model use the centralized constant.
🤖 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.

Nitpick comments:
In `@src/llm/routing.rs`:
- Line 39: Extract the Anthropic default model ID literal into a single constant
(e.g. ANTHROPIC_DEFAULT_MODEL: &str = "anthropic/claude-sonnet-4-20250514") and
replace all duplicated string occurrences (such as in the
Self::for_model("anthropic/claude-sonnet-4-20250514".into()) call and the other
occurrence around line 167) with ANTHROPIC_DEFAULT_MODEL (use .into() where
needed). Add the const near the top of routing.rs (module scope) so functions
like the referenced Self::for_model use the centralized constant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e02c9792-69df-4b5e-a1c7-40dc298530d1

📥 Commits

Reviewing files that changed from the base of the PR and between 21868af and 37f815f.

📒 Files selected for processing (1)
  • src/llm/routing.rs

Centralizes the Anthropic default model identifier to prevent
future drift when the dated model ID is bumped.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
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