mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-19 08:14:52 +00:00
fix: normalize stale copilot raptor-mini model
This commit is contained in:
1 parent
447033cb03
commit
c409a4522c
13 files changed
+633
-72
No files matched your search
@@ -13,6 +13,22 @@ const baseConfig: CopilotConfig = {
|
||||
};
|
||||
|
||||
describe('generateCopilotEnv', () => {
|
||||
it('normalizes deprecated raptor-mini model selections to the safe default', () => {
|
||||
const env = generateCopilotEnv({
|
||||
...baseConfig,
|
||||
model: 'raptor-mini',
|
||||
opus_model: 'raptor-mini',
|
||||
sonnet_model: 'raptor-mini',
|
||||
haiku_model: 'raptor-mini',
|
||||
});
|
||||
|
||||
expect(env.ANTHROPIC_MODEL).toBe('gpt-4.1');
|
||||
expect(env.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe('gpt-4.1');
|
||||
expect(env.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe('gpt-4.1');
|
||||
expect(env.ANTHROPIC_DEFAULT_HAIKU_MODEL).toBe('gpt-4.1');
|
||||
expect(env.ANTHROPIC_SMALL_FAST_MODEL).toBe('gpt-4.1');
|
||||
});
|
||||
|
||||
it('includes inherited CLAUDE_CONFIG_DIR when provided', () => {
|
||||
const env = generateCopilotEnv(baseConfig, '/tmp/.ccs/instances/pro');
|
||||
expect(env.CLAUDE_CONFIG_DIR).toBe('/tmp/.ccs/instances/pro');
|
||||
@@ -23,4 +39,3 @@ describe('generateCopilotEnv', () => {
|
||||
expect(env.CLAUDE_CONFIG_DIR).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import { describe, expect, it } from 'bun:test';
|
||||
import { DEFAULT_COPILOT_CONFIG } from '../../../src/config/unified-config-types';
|
||||
import {
|
||||
DEPRECATED_COPILOT_MODEL_IDS,
|
||||
normalizeCopilotConfig,
|
||||
normalizeCopilotModelId,
|
||||
normalizeCopilotSettings,
|
||||
} from '../../../src/copilot/copilot-model-normalizer';
|
||||
|
||||
describe('copilot-model-normalizer', () => {
|
||||
it('tracks raptor-mini as deprecated', () => {
|
||||
expect(DEPRECATED_COPILOT_MODEL_IDS).toContain('raptor-mini');
|
||||
});
|
||||
|
||||
it('normalizes deprecated model IDs to the safe default', () => {
|
||||
expect(normalizeCopilotModelId('raptor-mini')).toBe(DEFAULT_COPILOT_CONFIG.model);
|
||||
});
|
||||
|
||||
it('normalizes Copilot config tier mappings', () => {
|
||||
const normalized = normalizeCopilotConfig({
|
||||
...DEFAULT_COPILOT_CONFIG,
|
||||
model: 'raptor-mini',
|
||||
opus_model: 'raptor-mini',
|
||||
sonnet_model: 'raptor-mini',
|
||||
haiku_model: 'raptor-mini',
|
||||
});
|
||||
|
||||
expect(normalized.model).toBe('gpt-4.1');
|
||||
expect(normalized.opus_model).toBe('gpt-4.1');
|
||||
expect(normalized.sonnet_model).toBe('gpt-4.1');
|
||||
expect(normalized.haiku_model).toBe('gpt-4.1');
|
||||
});
|
||||
|
||||
it('normalizes raw settings payloads without dropping unrelated env keys', () => {
|
||||
const normalized = normalizeCopilotSettings(
|
||||
{
|
||||
env: {
|
||||
ANTHROPIC_BASE_URL: 'http://127.0.0.1:4141',
|
||||
ANTHROPIC_MODEL: 'raptor-mini',
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: 'raptor-mini',
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: 'raptor-mini',
|
||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: 'raptor-mini',
|
||||
EXTRA_FLAG: 'keep-me',
|
||||
},
|
||||
},
|
||||
{
|
||||
...DEFAULT_COPILOT_CONFIG,
|
||||
model: 'raptor-mini',
|
||||
}
|
||||
);
|
||||
|
||||
expect(normalized.env?.ANTHROPIC_MODEL).toBe('gpt-4.1');
|
||||
expect(normalized.env?.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe('gpt-4.1');
|
||||
expect(normalized.env?.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe('gpt-4.1');
|
||||
expect(normalized.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL).toBe('gpt-4.1');
|
||||
expect(normalized.env?.EXTRA_FLAG).toBe('keep-me');
|
||||
});
|
||||
});
|
||||
@@ -3,6 +3,10 @@ import * as http from 'http';
|
||||
import { DEFAULT_COPILOT_MODELS, fetchModelsFromDaemon } from '../../../src/copilot/copilot-models';
|
||||
|
||||
describe('fetchModelsFromDaemon', () => {
|
||||
it('does not advertise deprecated fallback models', () => {
|
||||
expect(DEFAULT_COPILOT_MODELS.some((model) => model.id === 'raptor-mini')).toBe(false);
|
||||
});
|
||||
|
||||
it('falls back to defaults when daemon is unreachable', async () => {
|
||||
const models = await fetchModelsFromDaemon(9999);
|
||||
expect(models).toEqual(DEFAULT_COPILOT_MODELS);
|
||||
|
||||
Reference in new issue
Block a user