Skip to content

fix(models): three-tier gateway defaults — fast / smart / reasoning#3652

Merged
mabry1985 merged 2 commits into
mainfrom
fix/default-models-via-gateway
May 24, 2026
Merged

fix(models): three-tier gateway defaults — fast / smart / reasoning#3652
mabry1985 merged 2 commits into
mainfrom
fix/default-models-via-gateway

Conversation

@mabry1985
Copy link
Copy Markdown
Contributor

@mabry1985 mabry1985 commented May 24, 2026

Closes `feature-1779521707518-ykrqtenoj` on the protomaker board.

Problem

The boxed defaults (`DEFAULT_PHASE_MODELS` in `libs/types/src/agent-settings.ts` and `DEFAULT_MODELS` in `libs/types/src/model.ts`) pointed at raw Anthropic IDs (`claude-haiku-4-5-20251001`, `claude-sonnet-4-6`, `claude-opus-4-6`). On a fresh install the only credential present is the protoLabs gateway key, which only authorizes `protolabs/*` models — so the defaults 401'd every time a feature dispatched without an explicit `model` field. We hit this earlier today on a crew smoke test.

Fix

Three code-work tiers map cleanly:

Alias Use case Anthropic-equivalent
`protolabs/fast` trivial / quick tasks haiku
`protolabs/smart` feature work + standard generation sonnet
`protolabs/reasoning` architectural / spec / deep-thinking opus
Default Old New
`DEFAULT_MODELS.claude` `protolabs/smart` (recent) `protolabs/reasoning`
`DEFAULT_MODELS.autoMode` `claude-sonnet-4-6` `protolabs/smart`
`DEFAULT_MODELS.trivial` `claude-haiku-4-5-20251001` `protolabs/fast`
`complexitySmallModel` `claude-haiku` `protolabs/fast`
`complexityMediumModel` `claude-sonnet` `protolabs/smart`
`complexityLargeModel` `claude-sonnet` `protolabs/smart`
`complexityArchitecturalModel` `claude-opus` `protolabs/reasoning`
`specGenerationModel` `claude-opus` `protolabs/reasoning`
`commitMessageModel` / `branchName` `claude-haiku` `protolabs/fast`

Note

`protolabs/reasoning` must be configured on the gateway before this lands.

What's NOT changed (separate follow-up)

These call sites still hardcode raw `claude-*` IDs and aren't on the crew-dispatch path:

  • `apps/server/src/routes/ai/index.ts` (in-product AI features)
  • `apps/server/src/providers/simple-query-service.ts`
  • `apps/server/src/lib/flow-model-factory.ts` (fallback)
  • `apps/server/src/services/ava-gateway-service.ts`
  • `apps/server/src/providers/claude-provider.ts` (Anthropic provider's own model list — correct as-is)

Verification

  • `npm run typecheck` — 21/21 packages clean
  • `npm run test:server -- tests/unit/services/auto-mode tests/unit/services/lead-engineer` — 282/282 pass
  • `resolveModelString('protolabs/reasoning')` → `'protolabs/reasoning'`
  • `resolveModelString(undefined)` → `'protolabs/reasoning'`
  • Prettier clean on touched files

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Updated AI model routing documentation to reflect new tier-based model selection strategy.
    • Revised default model assignments from Claude-based tiers to protoLabs gateway tiers for all task types.
  • Chores

    • Updated model escalation behavior for repeated failures and complexity-based routing.
    • Refined logging and messaging to align with new model tier naming conventions.

Review Change Stack

Closes feature-1779521707518-ykrqtenoj on the protomaker board.

The boxed defaults pointed at raw Anthropic IDs (claude-haiku-4-5,
claude-sonnet-4-6, claude-opus-4-6). On a fresh install the only
credential present is the protoLabs gateway key, which only authorizes
protolabs/* models — so the defaults 401'd every time a feature
dispatched without an explicit model field. We hit this earlier today
on a crew smoke test.

Three code-work tiers map cleanly:

  protolabs/fast       — trivial / quick tasks      (haiku-equivalent)
  protolabs/smart      — feature work               (sonnet-equivalent)
  protolabs/reasoning  — architectural / spec       (opus-equivalent)

Files touched:
- libs/types/src/agent-settings.ts  — DEFAULT_PHASE_MODELS
- libs/types/src/model.ts           — DEFAULT_MODELS.{claude,autoMode,trivial}
- apps/server/src/services/auto-mode-service.ts        — log lines
- apps/server/src/services/lead-engineer-processors.ts — log lines
- CLAUDE.md                         — model hierarchy table
- docs/integrations/ai-providers.md — complexity tiers + per-phase tables

Note: protolabs/reasoning must be configured on the gateway before
this lands.

Verified:
- npm run typecheck — 21/21 packages clean
- npm run test:server -- tests/unit/services/auto-mode
  tests/unit/services/lead-engineer — 282/282 pass
- resolveModelString('protolabs/reasoning') → 'protolabs/reasoning'
- resolveModelString(undefined) → 'protolabs/reasoning'

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mabry1985 mabry1985 enabled auto-merge (squash) May 24, 2026 06:09
@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-24T06:10:01Z
  • Git head: f24d4b8d6098c3d39b06ad80e0c8faabbadeb5c9
  • Features mapped: 3
  • Findings: 0

No findings recorded.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

Warning

Review limit reached

@mabry1985, we couldn't start this review because you've used your available PR reviews for now.

Your plan currently allows 8 reviews/hour. Refill in 34 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1bf0ea84-1a0c-4e91-ab8e-190deccdb7b8

📥 Commits

Reviewing files that changed from the base of the PR and between 81ee059 and 78a120c.

📒 Files selected for processing (3)
  • apps/server/tests/unit/lib/model-resolver.test.ts
  • apps/server/tests/unit/services/settings-service.test.ts
  • libs/model-resolver/tests/resolver.test.ts
📝 Walkthrough

Walkthrough

This PR updates default AI model selection across the system from direct Claude model IDs (haiku, sonnet, opus) to protoLabs gateway-backed tier IDs (fast, smart, reasoning). Configuration constants, service logging, and documentation are synchronized to reflect the new tier routing.

Changes

Model Tier Gateway Migration

Layer / File(s) Summary
Core model routing defaults
libs/types/src/model.ts, libs/types/src/agent-settings.ts
DEFAULT_MODELS.claude now points to protolabs/reasoning, while autoMode and trivial route to protolabs/smart and protolabs/fast respectively. DEFAULT_PHASE_MODELS updated across all phase entries to use corresponding protoLabs tiers instead of Claude-based defaults.
Service model selection comments and logging
apps/server/src/services/auto-mode-service.ts, apps/server/src/services/lead-engineer-processors.ts
Log messages and comments in model selection branches updated to refer to strongest available model, smart tiers, and fast models; no functional control flow or return value changes.
Model tier system and routing documentation
CLAUDE.md, docs/integrations/ai-providers.md
Complexity tier mapping, priority chain escalation logic, and per-phase task defaults documented using new protoLabs gateway model IDs; tier structure and routing intent clarified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • protoLabsAI/protoMaker#3622: Updates UI PhaseModelSelector to recognize LiteLLM gateway selections alongside backend defaults migration to protolabs/* model IDs.
  • protoLabsAI/protoMaker#3626: Parallel updates to Claude-related default model routing and provider/model dispatch behavior using protoLabs gateway tiers.

Poem

🐰 A gateway of tiers now lights the way,
Fast for the quick, Smart for the day,
Reasoning deep when complexity calls—
The rabbit hops through protoLabs halls! ✨

🚥 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 specifically summarizes the main change: replacing hardcoded Anthropic model IDs with three-tier protoLabs gateway defaults (fast/smart/reasoning).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
  • Commit unit tests in branch fix/default-models-via-gateway

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

@github-actions
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown

@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.

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 `@libs/types/src/agent-settings.ts`:
- Around line 243-245: The comment indicates a mismatch: in the "Quick tasks —
fast tier" block you have enhancementModel set to 'protolabs/smart' while
fileDescriptionModel is 'protolabs/fast'; fix by either moving the
enhancementModel entry out of the fast-tier section (so it stays as
'protolabs/smart' under the correct tier) or change enhancementModel to
'protolabs/fast' to match the fast-tier comment; locate and update the
enhancementModel and fileDescriptionModel entries in the agent settings
(symbols: enhancementModel, fileDescriptionModel) so the comment and values are
consistent.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 257a63f2-214b-4223-ab14-2030695da89d

📥 Commits

Reviewing files that changed from the base of the PR and between 3f0f568 and 81ee059.

📒 Files selected for processing (6)
  • CLAUDE.md
  • apps/server/src/services/auto-mode-service.ts
  • apps/server/src/services/lead-engineer-processors.ts
  • docs/integrations/ai-providers.md
  • libs/types/src/agent-settings.ts
  • libs/types/src/model.ts

Comment on lines +243 to +245
// Quick tasks — fast tier
enhancementModel: { model: 'protolabs/smart' },
fileDescriptionModel: { model: 'protolabs/fast' },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Comment-to-default mismatch on enhancement tier.

The heading says “Quick tasks — fast tier”, but enhancementModel is set to protolabs/smart. Please either move this entry out of the fast-tier section or adjust the value/comment to match.

🤖 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 `@libs/types/src/agent-settings.ts` around lines 243 - 245, The comment
indicates a mismatch: in the "Quick tasks — fast tier" block you have
enhancementModel set to 'protolabs/smart' while fileDescriptionModel is
'protolabs/fast'; fix by either moving the enhancementModel entry out of the
fast-tier section (so it stays as 'protolabs/smart' under the correct tier) or
change enhancementModel to 'protolabs/fast' to match the fast-tier comment;
locate and update the enhancementModel and fileDescriptionModel entries in the
agent settings (symbols: enhancementModel, fileDescriptionModel) so the comment
and values are consistent.

Three test assertions had the old default values baked in:

- apps/server/tests/unit/lib/model-resolver.test.ts:161
    DEFAULT_MODELS.claude was 'protolabs/smart' before the 3-tier
    work, is now 'protolabs/reasoning'.

- apps/server/tests/unit/services/settings-service.test.ts:745
    Migration-defaults check for specGenerationModel — was
    'claude-opus', is now 'protolabs/reasoning'.

- apps/server/tests/unit/services/settings-service.test.ts:760-762
    'use default phase models when none configured' — updated all
    three to gateway-routed defaults.

No production code change. Targeted server tests pass: 282/282 on
auto-mode + lead-engineer, 61/61 on libs/model-resolver, and the full
server suite recovers to clean.
@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-24T06:32:51Z
  • Git head: 93769f9f0e6ae8a231e3826348372a3074ee091c
  • Features mapped: 3
  • Findings: 0

No findings recorded.

@github-actions
Copy link
Copy Markdown
Contributor

@mabry1985 mabry1985 merged commit 33d4ab7 into main May 24, 2026
7 checks passed
@mabry1985 mabry1985 deleted the fix/default-models-via-gateway branch May 24, 2026 06:34
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