Skip to content

feat(providers): make proto the primary driver for agent runs#3626

Merged
mabry1985 merged 2 commits into
mainfrom
feat/rip-anthropic-sdk-finish-cutover
May 22, 2026
Merged

feat(providers): make proto the primary driver for agent runs#3626
mabry1985 merged 2 commits into
mainfrom
feat/rip-anthropic-sdk-finish-cutover

Conversation

@mabry1985
Copy link
Copy Markdown
Contributor

@mabry1985 mabry1985 commented May 22, 2026

Why

PR 2 of the namesake SDK cutover. PR 1 (#3625) added `ProtoProvider` alongside `ClaudeProvider`. This PR flips the defaults so every active model dispatch — Claude-shaped ids included — routes through `@protolabsai/sdk` instead of `@anthropic-ai/claude-agent-sdk`. The Anthropic SDK dependency stays installed for one more PR while `sdk-options.ts` (1000+ lines of Claude-shaped option builders + hook matchers) is migrated; once that lands the dep is removed and `claude-provider.ts` is deleted.

Changes

`apps/server/src/providers/proto-provider.ts` — widened `isProtoModel` to also claim `claude-*` ids and the bare aliases `opus` / `sonnet` / `haiku`. The gateway already resolves Claude SKUs transparently, so callers that store `claude-opus-4-5-...` keep working with no migration on persisted state.

`libs/types/src/model.ts` — `DEFAULT_MODELS.claude` flipped from `claude-opus-4-6` to `protolabs/smart`. Field name preserved through this PR (rename to `proto` lands in PR 3) so the ~6 call sites in `auto-mode-service.ts` and `lead-engineer-processors.ts` compile without touching their lines.

`apps/server/src/services/ava-gateway-service.ts` — instantiates `ProtoProvider` instead of `ClaudeProvider`. The two are interface-compatible (both extend `BaseProvider` and implement `executeQuery`), so this is a one-line file-import change plus a class rename.

`apps/server/tests/unit/providers/provider-factory.test.ts` — bumps Claude-routed expectations to ProtoProvider for the cases the new matcher claims. Tests for "unknown model fallback" and "empty string fallback" still resolve to ClaudeProvider since ProtoProvider's matcher is explicit (no catch-all).

`apps/server/tests/unit/lib/model-resolver.test.ts` — asserts the new `DEFAULT_MODELS.claude` value.

Routing matrix (verified programmatically)

```
protolabs/smart → proto ← new primary
protolabs/fast → proto ← new primary
claude-opus-4-5-20251101 → proto ← legacy id, gateway-routed
claude-sonnet-4-20250514 → proto ← legacy id, gateway-routed
opus → proto ← bare alias, gateway-routed
sonnet → proto ← bare alias, gateway-routed
haiku → proto ← bare alias, gateway-routed
cursor-auto → cursor ← unchanged
codex-gpt-5.5 → codex ← unchanged
unknown-xyz → claude ← unchanged fallback (PR 3 cleans up)
```

What this PR explicitly does NOT change

  • `apps/server/src/lib/sdk-options.ts` is untouched. The 1005 lines of `Options` / `HookCallback` / `PostToolUseHookInput` consumers stay until PR 3. The hook callback shape difference (Claude's structured input vs proto's `unknown + toolUseId`) is the bulk of PR 3's diff.
  • `apps/server/src/providers/claude-provider.ts` stays registered as the unknown-model fallback. Once `isProtoModel` widens to a catch-all in PR 3, this becomes unreachable and gets deleted along with the dep.
  • `apps/server/src/routes/setup/routes/verify-claude-auth.ts` and the four UI call sites that hit it stay until PR 3 — they're not reachable from any active runtime path (gateway-routed chat in fix(chat): route through LiteLLM gateway, default to protolabs/smart #3619 made it inert) but deleting them requires UI surgery.
  • `@anthropic-ai/claude-agent-sdk` stays in `package.json` for one more PR.

Validation

After this lands

PR 3 closes the loop:

  1. Migrate `sdk-options.ts` to proto SDK types (hook callbacks rewritten for proto's signature)
  2. Widen `isProtoModel` to a catch-all for non-cursor/codex/opencode/groq/openai-compatible models
  3. Delete `claude-provider.ts` + `verify-claude-auth.ts` + the 4 UI setup steps that target verify-claude-auth
  4. Rename `DEFAULT_MODELS.claude` → `DEFAULT_MODELS.proto` everywhere
  5. Remove `@anthropic-ai/claude-agent-sdk` from `apps/server/package.json`

Summary by CodeRabbit

Release Notes

  • Updates
    • Optimized default Claude model routing through an improved gateway provider system for enhanced performance
    • Enhanced support for Claude model aliases (opus, sonnet, haiku) with consistent provider routing
    • Updated legacy Claude model IDs to work seamlessly with the new routing infrastructure
    • Improved overall model provider resolution consistency and reliability across the platform

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a02f9e6d-81f3-4454-bb84-1f1c4e4d8364

📥 Commits

Reviewing files that changed from the base of the PR and between 555bec5 and 0d9b8be.

📒 Files selected for processing (6)
  • apps/server/src/providers/proto-provider.ts
  • apps/server/src/services/ava-gateway-service.ts
  • apps/server/tests/unit/lib/model-resolver.test.ts
  • apps/server/tests/unit/providers/provider-factory.test.ts
  • libs/model-resolver/tests/resolver.test.ts
  • libs/types/src/model.ts

📝 Walkthrough

Walkthrough

This PR routes legacy Claude model identifiers (claude-*) and bare aliases (opus, sonnet, haiku) through ProtoProvider instead of ClaudeProvider. Changes include updating the default model constant to protolabs/smart, broadening the provider routing logic, switching the gateway heartbeat provider, and updating all corresponding test assertions.

Changes

Claude Model ID Routing to ProtoProvider

Layer / File(s) Summary
Default model contract update
libs/types/src/model.ts
DEFAULT_MODELS.claude is updated from claude-opus-4-6 to protolabs/smart with expanded documentation describing gateway resolution behavior.
Provider routing policy expansion
apps/server/src/providers/proto-provider.ts
isProtoModel is broadened to match claude-* model IDs and bare aliases (opus, sonnet, haiku), with updated documentation noting ProtoProvider factory priority.
Gateway heartbeat provider integration
apps/server/src/services/ava-gateway-service.ts
AvaGatewayService switches from ClaudeProvider to ProtoProvider for heartbeat queries through import addition, provider field type change, and lazy initialization in runHeartbeat().
Test coverage and routing validation
apps/server/tests/unit/providers/provider-factory.test.ts, apps/server/tests/unit/lib/model-resolver.test.ts, libs/model-resolver/tests/resolver.test.ts
Unit and integration tests are updated to expect ProtoProvider for Claude-shaped model IDs and verify DEFAULT_MODELS.claude resolves to protolabs/smart, with case-insensitive matching assertions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • protoLabsAI/protoMaker#3625: Builds directly on the retrieved ProtoProvider work by modifying isProtoModel/provider routing to match more Claude-shaped model IDs and updating gateway/heartbeat to use ProtoProvider, tightly connected to the same provider/factory logic.

Poem

🐰 A Claude by any name now finds its way,
Through Proto's gates where models smartly play,
From aliases old to routes brand new,
The heartbeat gateway pulses ProtoProvider true,
Legacy paths merge into tomorrow's view!

🚥 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 'feat(providers): make proto the primary driver for agent runs' accurately summarizes the main change: routing model dispatches through ProtoProvider instead of ClaudeProvider as the primary driver.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rip-anthropic-sdk-finish-cutover

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

@github-actions
Copy link
Copy Markdown
Contributor

Code Review — ? finding(s)

Async review running parallel to CodeRabbit. Findings are advisory; not all are merge blockers.

protoLabs Code Review Report

  • Generated: 2026-05-22T09:59:58Z
  • Git head: a6e05b6f9eea09a2044f99a15a668fa1773e4cfb
  • Features mapped: 3
  • Findings: 0

No findings recorded.

@github-actions
Copy link
Copy Markdown
Contributor

Code Review — ? finding(s)

Async review running parallel to CodeRabbit. Findings are advisory; not all are merge blockers.

protoLabs Code Review Report

  • Generated: 2026-05-22T19:05:44Z
  • Git head: 1378bcfed81e56fa3dd818d258efc908c7347c32
  • Features mapped: 3
  • Findings: 0

No findings recorded.

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