Skip to content

Commit e84f901

Browse files
fix(patch): cherry-pick d96bd05 to release/v0.29.6-pr-19867 to patch version v0.29.6 and create version 0.29.7 (#20111)
Co-authored-by: Bryan Morgan <bryanmorgan@google.com>
1 parent 53019e5 commit e84f901

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

packages/core/src/config/config.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,21 @@ describe('Config Quota & Preview Model Access', () => {
20192019
expect(config.getHasAccessToPreviewModel()).toBe(true);
20202020
});
20212021

2022+
it('should update hasAccessToPreviewModel to true if quota includes Gemini 3.1 preview model', async () => {
2023+
mockCodeAssistServer.retrieveUserQuota.mockResolvedValue({
2024+
buckets: [
2025+
{
2026+
modelId: 'gemini-3.1-pro-preview',
2027+
remainingAmount: '100',
2028+
remainingFraction: 1.0,
2029+
},
2030+
],
2031+
});
2032+
2033+
await config.refreshUserQuota();
2034+
expect(config.getHasAccessToPreviewModel()).toBe(true);
2035+
});
2036+
20222037
it('should update hasAccessToPreviewModel to false if quota does not include preview model', async () => {
20232038
mockCodeAssistServer.retrieveUserQuota.mockResolvedValue({
20242039
buckets: [

packages/core/src/config/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,8 @@ export class Config {
14441444
}
14451445

14461446
const hasAccess =
1447-
quota.buckets?.some((b) => b.modelId === PREVIEW_GEMINI_MODEL) ?? false;
1447+
quota.buckets?.some((b) => b.modelId && isPreviewModel(b.modelId)) ??
1448+
false;
14481449
this.setHasAccessToPreviewModel(hasAccess);
14491450
return quota;
14501451
} catch (e) {

packages/core/src/config/models.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe('isPreviewModel', () => {
3434
it('should return true for preview models', () => {
3535
expect(isPreviewModel(PREVIEW_GEMINI_MODEL)).toBe(true);
3636
expect(isPreviewModel(PREVIEW_GEMINI_3_1_MODEL)).toBe(true);
37+
expect(isPreviewModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL)).toBe(true);
3738
expect(isPreviewModel(PREVIEW_GEMINI_FLASH_MODEL)).toBe(true);
3839
expect(isPreviewModel(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
3940
});

packages/core/src/config/models.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export function isPreviewModel(model: string): boolean {
134134
return (
135135
model === PREVIEW_GEMINI_MODEL ||
136136
model === PREVIEW_GEMINI_3_1_MODEL ||
137+
model === PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL ||
137138
model === PREVIEW_GEMINI_FLASH_MODEL ||
138139
model === PREVIEW_GEMINI_MODEL_AUTO
139140
);

0 commit comments

Comments
 (0)