Skip to content

Commit a24009f

Browse files
fix(patch): cherry-pick d96bd05 to release/v0.30.0-preview.5-pr-19867 to patch version v0.30.0-preview.5 and create version 0.30.0-preview.6 (#20112)
Co-authored-by: Bryan Morgan <bryanmorgan@google.com>
1 parent fdd96a0 commit a24009f

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
@@ -2063,6 +2063,21 @@ describe('Config Quota & Preview Model Access', () => {
20632063
expect(config.getHasAccessToPreviewModel()).toBe(true);
20642064
});
20652065

2066+
it('should update hasAccessToPreviewModel to true if quota includes Gemini 3.1 preview model', async () => {
2067+
mockCodeAssistServer.retrieveUserQuota.mockResolvedValue({
2068+
buckets: [
2069+
{
2070+
modelId: 'gemini-3.1-pro-preview',
2071+
remainingAmount: '100',
2072+
remainingFraction: 1.0,
2073+
},
2074+
],
2075+
});
2076+
2077+
await config.refreshUserQuota();
2078+
expect(config.getHasAccessToPreviewModel()).toBe(true);
2079+
});
2080+
20662081
it('should update hasAccessToPreviewModel to false if quota does not include preview model', async () => {
20672082
mockCodeAssistServer.retrieveUserQuota.mockResolvedValue({
20682083
buckets: [

packages/core/src/config/config.ts

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

14691469
const hasAccess =
1470-
quota.buckets?.some((b) => b.modelId === PREVIEW_GEMINI_MODEL) ?? false;
1470+
quota.buckets?.some((b) => b.modelId && isPreviewModel(b.modelId)) ??
1471+
false;
14711472
this.setHasAccessToPreviewModel(hasAccess);
14721473
return quota;
14731474
} catch (e) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('isPreviewModel', () => {
3636
it('should return true for preview models', () => {
3737
expect(isPreviewModel(PREVIEW_GEMINI_MODEL)).toBe(true);
3838
expect(isPreviewModel(PREVIEW_GEMINI_3_1_MODEL)).toBe(true);
39+
expect(isPreviewModel(PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL)).toBe(true);
3940
expect(isPreviewModel(PREVIEW_GEMINI_FLASH_MODEL)).toBe(true);
4041
expect(isPreviewModel(PREVIEW_GEMINI_MODEL_AUTO)).toBe(true);
4142
});

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)