mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-08-09 00:16:57 -07:00
fix(core): ensure stable fallback for restricted preview models (#26999)
This commit is contained in:
@@ -20,6 +20,8 @@ import {
|
||||
applyAvailabilityTransition,
|
||||
} from '../availability/policyHelpers.js';
|
||||
|
||||
import { isPreviewModel } from '../config/models.js';
|
||||
|
||||
export const UPGRADE_URL_PAGE = 'https://goo.gle/set-up-gemini-code-assist';
|
||||
|
||||
export async function handleFallback(
|
||||
@@ -28,13 +30,19 @@ export async function handleFallback(
|
||||
authType?: string,
|
||||
error?: unknown,
|
||||
): Promise<string | boolean | null> {
|
||||
const failureKind = classifyFailureKind(error);
|
||||
|
||||
// If a preview model is not found, record that the user lacks preview access.
|
||||
if (failureKind === 'not_found' && isPreviewModel(failedModel, config)) {
|
||||
config.setHasAccessToPreviewModel?.(false);
|
||||
}
|
||||
|
||||
const chain = resolvePolicyChain(config);
|
||||
const { failedPolicy, candidates } = buildFallbackPolicyContext(
|
||||
chain,
|
||||
failedModel,
|
||||
);
|
||||
|
||||
const failureKind = classifyFailureKind(error);
|
||||
const availability = config.getModelAvailabilityService();
|
||||
const getAvailabilityContext = () => {
|
||||
if (!failedPolicy) return undefined;
|
||||
|
||||
Reference in New Issue
Block a user