Files
ruvnet__ruflo/v3/@claude-flow/cli/__tests__/model-resolution-2232.test.ts
ruvnet 3e9122a310 feat(routing): default to latest Claude 5/4.x models in tier map + init template
- MODEL_MAP: `sonnet` alias bumped from claude-sonnet-4-6 → claude-sonnet-5 (matches the current Claude 5 family default). Prior pin remains reachable via new `sonnet-4.6` alias for back-compat.
- DEFAULT_ANTHROPIC_MODEL and `inherit` now resolve to claude-sonnet-5.
- ruflo init template (settings-generator.ts): top-level `model` set to claude-sonnet-5 (previously commented out with a stale sonnet-4-5 hint); `claudeFlow.modelPreferences.default` bumped from opus-4-8 → claude-sonnet-5.
- Project `.claude/settings.json` synced with the new template output (model + modelPreferences); removed the stale skillListingBudgetFraction rationale comment (kept the 0.06 value — #1834 still has 358 SKILL.md duplicates, workaround is still load-bearing).
- Test updates for #2232 / #1906 regression guards to assert the new sonnet-5 resolution and the new `sonnet-4.6` back-compat alias.

Bumps @claude-flow/cli, claude-flow, and ruflo to 3.30.4 (PATCH — no API change, default-model refresh only). All 30 model-resolution/sampling-params tests + 400 commands-deep tests green.

Follow-up: sampling-params regex in agent-execute-core.ts (#2357) may need `sonnet-5` added if Sonnet 5 rejects temperature/top_p/top_k like the rest of the Claude 5 family — not touched here because I don't have that behavior confirmed.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-07-15 11:16:31 -04:00

49 lines
2.0 KiB
TypeScript

// Regression tests for #2232 — Opus 4.8 alias + literal-id silent downgrade.
//
// Before the fix:
// - `opus` mapped to `claude-opus-4-7` (a version behind).
// - executeAgentTask used `MODEL_MAP[x] || DEFAULT` directly, so any literal
// `claude-*` id silently collapsed to Sonnet 4.6.
//
// After the fix:
// - `opus` → `claude-opus-4-8`, `opus-4.7` reachable for the prior pin.
// - Resolution funnels through `resolveAnthropicModel`, which passes literal
// ids through unchanged.
import { describe, it, expect } from 'vitest';
import { resolveAnthropicModel, DEFAULT_ANTHROPIC_MODEL } from '../src/mcp-tools/agent-execute-core.js';
describe('model resolution (#2232)', () => {
it('maps the `opus` alias to the current Opus (4.8)', () => {
expect(resolveAnthropicModel('opus')).toBe('claude-opus-4-8');
});
it('keeps the prior Opus pin reachable via `opus-4.7`', () => {
expect(resolveAnthropicModel('opus-4.7')).toBe('claude-opus-4-7');
});
it('maps `sonnet` and `haiku` aliases to current ids', () => {
expect(resolveAnthropicModel('sonnet')).toBe('claude-sonnet-5');
expect(resolveAnthropicModel('haiku')).toBe('claude-haiku-4-5-20251001');
});
it('keeps the prior Sonnet pin reachable via `sonnet-4.6`', () => {
expect(resolveAnthropicModel('sonnet-4.6')).toBe('claude-sonnet-4-6');
});
it('passes a literal Anthropic model id through unchanged (no silent Sonnet fallback)', () => {
expect(resolveAnthropicModel('claude-opus-4-8')).toBe('claude-opus-4-8');
expect(resolveAnthropicModel('claude-opus-4-8')).not.toBe(DEFAULT_ANTHROPIC_MODEL);
expect(resolveAnthropicModel('claude-opus-4-7')).toBe('claude-opus-4-7');
});
it('strips the `anthropic:` prefix', () => {
expect(resolveAnthropicModel('anthropic:claude-opus-4-8')).toBe('claude-opus-4-8');
});
it('falls back to DEFAULT only when the input is undefined / empty', () => {
expect(resolveAnthropicModel(undefined)).toBe(DEFAULT_ANTHROPIC_MODEL);
expect(resolveAnthropicModel('')).toBe(DEFAULT_ANTHROPIC_MODEL);
});
});