mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 04:18:05 +00:00
fix(cliproxy): disable 1M extended context for opus 4.6 (256k limit) (#492)
* fix(cliproxy): disable 1M extended context for gemini-claude-opus-4-6-thinking Antigravity backend only supports 256k context window for this model, not 1M as previously declared. Set extendedContext: false with TODO comment for easy re-enable when backend adds support. Closes #490 * fix(cliproxy): strip [1m] suffix at runtime for models without extended context Users with existing [1m] in saved agy.settings.json will now have it automatically stripped at runtime when the model no longer supports extended context. Prevents misleading context window claims.
This commit is contained in:
@@ -85,7 +85,25 @@ export function applyExtendedContextConfig(
|
||||
const baseModel = envVars.ANTHROPIC_MODEL || '';
|
||||
const cleanModelId = stripModelSuffixes(baseModel);
|
||||
|
||||
// Tier model env vars to apply/strip extended context suffix
|
||||
const tierModels = [
|
||||
'ANTHROPIC_DEFAULT_OPUS_MODEL',
|
||||
'ANTHROPIC_DEFAULT_SONNET_MODEL',
|
||||
'ANTHROPIC_DEFAULT_HAIKU_MODEL',
|
||||
] as const;
|
||||
|
||||
if (!shouldApplyExtendedContext(provider, cleanModelId, extendedContextOverride)) {
|
||||
// Strip [1m] suffix from models that no longer support extended context
|
||||
// (e.g., user had it enabled before backend dropped support)
|
||||
if (envVars.ANTHROPIC_MODEL?.toLowerCase().endsWith('[1m]')) {
|
||||
envVars.ANTHROPIC_MODEL = envVars.ANTHROPIC_MODEL.replace(/\[1m\]$/i, '');
|
||||
}
|
||||
for (const tierVar of tierModels) {
|
||||
const model = envVars[tierVar];
|
||||
if (model?.toLowerCase().endsWith('[1m]')) {
|
||||
envVars[tierVar] = model.replace(/\[1m\]$/i, '');
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,11 +113,6 @@ export function applyExtendedContextConfig(
|
||||
}
|
||||
|
||||
// Apply to tier models if they support extended context
|
||||
const tierModels = [
|
||||
'ANTHROPIC_DEFAULT_OPUS_MODEL',
|
||||
'ANTHROPIC_DEFAULT_SONNET_MODEL',
|
||||
'ANTHROPIC_DEFAULT_HAIKU_MODEL',
|
||||
] as const;
|
||||
|
||||
for (const tierVar of tierModels) {
|
||||
const model = envVars[tierVar];
|
||||
|
||||
@@ -78,7 +78,7 @@ export const MODEL_CATALOG: Partial<Record<CLIProxyProvider, ProviderCatalog>> =
|
||||
{
|
||||
id: 'gemini-claude-opus-4-6-thinking',
|
||||
name: 'Claude Opus 4.6 Thinking',
|
||||
description: 'Latest flagship, 1M context, extended thinking',
|
||||
description: 'Latest flagship, extended thinking',
|
||||
thinking: {
|
||||
type: 'budget',
|
||||
min: 1024,
|
||||
@@ -86,7 +86,9 @@ export const MODEL_CATALOG: Partial<Record<CLIProxyProvider, ProviderCatalog>> =
|
||||
zeroAllowed: true,
|
||||
dynamicAllowed: true,
|
||||
},
|
||||
extendedContext: true,
|
||||
// TODO: Re-enable when Antigravity backend supports 1M context (currently 256k)
|
||||
// extendedContext: true,
|
||||
extendedContext: false,
|
||||
},
|
||||
{
|
||||
id: 'gemini-claude-opus-4-5-thinking',
|
||||
|
||||
@@ -151,4 +151,23 @@ describe('applyExtendedContextConfig', () => {
|
||||
applyExtendedContextConfig(env, 'gemini', undefined);
|
||||
expect(env.ANTHROPIC_MODEL).toBeUndefined();
|
||||
});
|
||||
|
||||
it('strips [1m] suffix from models that no longer support extended context', () => {
|
||||
// Simulates user who had [1m] in saved settings before support was removed
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
ANTHROPIC_MODEL: 'gemini-claude-opus-4-6-thinking[1m]',
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: 'gemini-claude-opus-4-6-thinking[1m]',
|
||||
};
|
||||
applyExtendedContextConfig(env, 'agy', undefined);
|
||||
expect(env.ANTHROPIC_MODEL).toBe('gemini-claude-opus-4-6-thinking');
|
||||
expect(env.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe('gemini-claude-opus-4-6-thinking');
|
||||
});
|
||||
|
||||
it('strips [1m] suffix when --no-1m is explicit even if model has it', () => {
|
||||
const env: NodeJS.ProcessEnv = {
|
||||
ANTHROPIC_MODEL: 'gemini-2.5-pro[1m]',
|
||||
};
|
||||
applyExtendedContextConfig(env, 'gemini', false);
|
||||
expect(env.ANTHROPIC_MODEL).toBe('gemini-2.5-pro');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,8 +23,7 @@ const badgeVariants = cva(
|
||||
);
|
||||
|
||||
interface BadgeProps
|
||||
extends React.HTMLAttributes<HTMLDivElement>,
|
||||
VariantProps<typeof badgeVariants> {}
|
||||
extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
|
||||
|
||||
function Badge({ className, variant, ...props }: BadgeProps) {
|
||||
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
|
||||
|
||||
@@ -15,8 +15,10 @@ export const MODEL_CATALOGS: Record<string, ProviderCatalog> = {
|
||||
{
|
||||
id: 'gemini-claude-opus-4-6-thinking',
|
||||
name: 'Claude Opus 4.6 Thinking',
|
||||
description: 'Latest flagship, 1M context, extended thinking',
|
||||
extendedContext: true,
|
||||
description: 'Latest flagship, extended thinking',
|
||||
// TODO: Re-enable when Antigravity backend supports 1M context (currently 256k)
|
||||
// extendedContext: true,
|
||||
extendedContext: false,
|
||||
presetMapping: {
|
||||
default: 'gemini-claude-opus-4-6-thinking',
|
||||
opus: 'gemini-claude-opus-4-6-thinking',
|
||||
|
||||
Reference in New Issue
Block a user