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
17 changes: 17 additions & 0 deletions packages/core/src/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,23 @@

expect(onModelChange).not.toHaveBeenCalled();
});

it('should call onModelChange when persisting a model that was previously temporary', () => {
const onModelChange = vi.fn();
const config = new Config({
...baseParams,
model: 'some-other-model',
onModelChange,
});

// Temporary selection
config.setModel(DEFAULT_GEMINI_MODEL, true);
expect(onModelChange).not.toHaveBeenCalled();

// Persist selection of the same model
config.setModel(DEFAULT_GEMINI_MODEL, false);
expect(onModelChange).toHaveBeenCalledWith(DEFAULT_GEMINI_MODEL);
});
});
});

Expand Down Expand Up @@ -2499,7 +2516,7 @@
mockCodeAssistServer.retrieveUserQuota.mockResolvedValue({
buckets: [
{
modelId: 'gemini-3.1-pro-preview',

Check warning on line 2519 in packages/core/src/config/config.test.ts

View workflow job for this annotation

GitHub Actions / Lint

Found sensitive keyword "gemini-3.1". Please make sure this change is appropriate to submit.
remainingAmount: '100',
remainingFraction: 1.0,
},
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1403,9 +1403,9 @@ export class Config implements McpContext {
// When the user explicitly sets a model, that becomes the active model.
this._activeModel = newModel;
coreEvents.emitModelChanged(newModel);
if (this.onModelChange && !isTemporary) {
this.onModelChange(newModel);
}
}
if (this.onModelChange && !isTemporary) {
this.onModelChange(newModel);
}
this.modelAvailabilityService.reset();
}
Expand Down
Loading