Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/core/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,10 @@ export class Config implements McpContext, AgentLoopContext {
this.baseLlmClient = new BaseLlmClient(this.contentGenerator, this);

const authType = this.contentGeneratorConfig.authType;
if (authType === AuthType.USE_GEMINI) {
if (
authType === AuthType.USE_GEMINI ||
authType === AuthType.USE_VERTEX_AI
) {
Comment on lines +1630 to +1633

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current logic for setting hasAccessToPreviewModel to true is becoming repetitive and currently misses AuthType.GATEWAY, which is treated as a 'launched' auth type elsewhere in this file (see isGemini31LaunchedForAuthType at line 3498). Using the existing private helper isGemini31LaunchedForAuthType would improve maintainability and ensure consistency across all relevant authentication types, including Gateway users who should also have preview access by default.

    if (this.isGemini31LaunchedForAuthType(authType)) {
References
  1. Avoid overlapping checks in model resolution logic by relying on condensed sources of truth to ensure consistency and reduce logic duplication.

this.setHasAccessToPreviewModel(true);
}

Expand Down
7 changes: 0 additions & 7 deletions packages/core/src/fallback/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ 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(
Expand All @@ -32,11 +30,6 @@ export async function handleFallback(
): 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,
Expand Down
Loading