Files
ruvnet__ruflo/v3/@claude-flow/cli/__tests__/agent-execute-models.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

44 lines
1.9 KiB
TypeScript

/**
* Regression guard for ruvnet/ruflo#1906 — model aliases must map to
* current (Claude 4.x) model ids, not the deprecated Claude-3.x ids that
* the Anthropic API now 404s.
*/
import { describe, it, expect } from 'vitest';
import { resolveAnthropicModel, DEFAULT_ANTHROPIC_MODEL } from '../src/mcp-tools/agent-execute-core.js';
describe('#1906 — agent_execute model aliases resolve to current Claude 4.x ids', () => {
it('haiku → claude-haiku-4-5-20251001', () => {
expect(resolveAnthropicModel('haiku')).toBe('claude-haiku-4-5-20251001');
});
it('sonnet → claude-sonnet-5 (bumped from 4-6)', () => {
expect(resolveAnthropicModel('sonnet')).toBe('claude-sonnet-5');
});
it('sonnet-4.6 reaches the prior pin', () => {
expect(resolveAnthropicModel('sonnet-4.6')).toBe('claude-sonnet-4-6');
});
it('opus → claude-opus-4-8 (#2232 alias bump)', () => {
expect(resolveAnthropicModel('opus')).toBe('claude-opus-4-8');
});
it('opus-4.7 reaches the prior pin', () => {
expect(resolveAnthropicModel('opus-4.7')).toBe('claude-opus-4-7');
});
it('inherit → the default (sonnet 5)', () => {
expect(resolveAnthropicModel('inherit')).toBe('claude-sonnet-5');
expect(DEFAULT_ANTHROPIC_MODEL).toBe('claude-sonnet-5');
});
it('undefined → the default', () => {
expect(resolveAnthropicModel(undefined)).toBe(DEFAULT_ANTHROPIC_MODEL);
});
it('anthropic:<id> prefix is stripped', () => {
expect(resolveAnthropicModel('anthropic:claude-opus-4-7')).toBe('claude-opus-4-7');
});
it('a bare model id passes through unchanged', () => {
expect(resolveAnthropicModel('claude-sonnet-4-6')).toBe('claude-sonnet-4-6');
});
it('no alias resolves to a deprecated claude-3.x id (#1906 regression)', () => {
for (const alias of ['haiku', 'sonnet', 'opus', 'inherit', undefined]) {
expect(resolveAnthropicModel(alias as string | undefined)).not.toMatch(/^claude-3[.-]/);
}
});
});