mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 08:19:59 +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 baseModel = envVars.ANTHROPIC_MODEL || '';
|
||||||
const cleanModelId = stripModelSuffixes(baseModel);
|
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)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,11 +113,6 @@ export function applyExtendedContextConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply to tier models if they support extended context
|
// 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) {
|
for (const tierVar of tierModels) {
|
||||||
const model = envVars[tierVar];
|
const model = envVars[tierVar];
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export const MODEL_CATALOG: Partial<Record<CLIProxyProvider, ProviderCatalog>> =
|
|||||||
{
|
{
|
||||||
id: 'gemini-claude-opus-4-6-thinking',
|
id: 'gemini-claude-opus-4-6-thinking',
|
||||||
name: 'Claude Opus 4.6 Thinking',
|
name: 'Claude Opus 4.6 Thinking',
|
||||||
description: 'Latest flagship, 1M context, extended thinking',
|
description: 'Latest flagship, extended thinking',
|
||||||
thinking: {
|
thinking: {
|
||||||
type: 'budget',
|
type: 'budget',
|
||||||
min: 1024,
|
min: 1024,
|
||||||
@@ -86,7 +86,9 @@ export const MODEL_CATALOG: Partial<Record<CLIProxyProvider, ProviderCatalog>> =
|
|||||||
zeroAllowed: true,
|
zeroAllowed: true,
|
||||||
dynamicAllowed: 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',
|
id: 'gemini-claude-opus-4-5-thinking',
|
||||||
|
|||||||
@@ -151,4 +151,23 @@ describe('applyExtendedContextConfig', () => {
|
|||||||
applyExtendedContextConfig(env, 'gemini', undefined);
|
applyExtendedContextConfig(env, 'gemini', undefined);
|
||||||
expect(env.ANTHROPIC_MODEL).toBeUndefined();
|
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
|
interface BadgeProps
|
||||||
extends React.HTMLAttributes<HTMLDivElement>,
|
extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
|
||||||
VariantProps<typeof badgeVariants> {}
|
|
||||||
|
|
||||||
function Badge({ className, variant, ...props }: BadgeProps) {
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
||||||
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
|
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',
|
id: 'gemini-claude-opus-4-6-thinking',
|
||||||
name: 'Claude Opus 4.6 Thinking',
|
name: 'Claude Opus 4.6 Thinking',
|
||||||
description: 'Latest flagship, 1M context, extended thinking',
|
description: 'Latest flagship, extended thinking',
|
||||||
extendedContext: true,
|
// TODO: Re-enable when Antigravity backend supports 1M context (currently 256k)
|
||||||
|
// extendedContext: true,
|
||||||
|
extendedContext: false,
|
||||||
presetMapping: {
|
presetMapping: {
|
||||||
default: 'gemini-claude-opus-4-6-thinking',
|
default: 'gemini-claude-opus-4-6-thinking',
|
||||||
opus: 'gemini-claude-opus-4-6-thinking',
|
opus: 'gemini-claude-opus-4-6-thinking',
|
||||||
|
|||||||
Reference in New Issue
Block a user