mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 18:14:29 -07:00
Fix an issue where the agent stops prematurely (#16269)
This commit is contained in:
committed by
GitHub
parent
356f76e545
commit
c87d1aed4c
@@ -70,6 +70,7 @@ describe('useQuotaAndFallback', () => {
|
||||
setFallbackHandlerSpy = vi.spyOn(mockConfig, 'setFallbackModelHandler');
|
||||
vi.spyOn(mockConfig, 'setQuotaErrorOccurred');
|
||||
vi.spyOn(mockConfig, 'setModel');
|
||||
vi.spyOn(mockConfig, 'setActiveModel');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -164,8 +165,8 @@ describe('useQuotaAndFallback', () => {
|
||||
const intent = await promise!;
|
||||
expect(intent).toBe('retry_always');
|
||||
|
||||
// Verify setModel was called with isFallbackModel=true
|
||||
expect(mockConfig.setModel).toHaveBeenCalledWith('gemini-flash', true);
|
||||
// Verify setActiveModel was called
|
||||
expect(mockConfig.setActiveModel).toHaveBeenCalledWith('gemini-flash');
|
||||
|
||||
// The pending request should be cleared from the state
|
||||
expect(result.current.proQuotaRequest).toBeNull();
|
||||
@@ -278,8 +279,8 @@ describe('useQuotaAndFallback', () => {
|
||||
const intent = await promise!;
|
||||
expect(intent).toBe('retry_always');
|
||||
|
||||
// Verify setModel was called with isFallbackModel=true
|
||||
expect(mockConfig.setModel).toHaveBeenCalledWith('model-B', true);
|
||||
// Verify setActiveModel was called
|
||||
expect(mockConfig.setActiveModel).toHaveBeenCalledWith('model-B');
|
||||
|
||||
// The pending request should be cleared from the state
|
||||
expect(result.current.proQuotaRequest).toBeNull();
|
||||
@@ -336,10 +337,9 @@ To disable gemini-3-pro-preview, disable "Preview features" in /settings.`,
|
||||
const intent = await promise!;
|
||||
expect(intent).toBe('retry_always');
|
||||
|
||||
// Verify setModel was called with isFallbackModel=true
|
||||
expect(mockConfig.setModel).toHaveBeenCalledWith(
|
||||
// Verify setActiveModel was called
|
||||
expect(mockConfig.setActiveModel).toHaveBeenCalledWith(
|
||||
'gemini-2.5-pro',
|
||||
true,
|
||||
);
|
||||
|
||||
expect(result.current.proQuotaRequest).toBeNull();
|
||||
@@ -425,8 +425,12 @@ To disable gemini-3-pro-preview, disable "Preview features" in /settings.`,
|
||||
expect(intent).toBe('retry_always');
|
||||
expect(result.current.proQuotaRequest).toBeNull();
|
||||
|
||||
// Verify setModel was called with isFallbackModel=true
|
||||
expect(mockConfig.setModel).toHaveBeenCalledWith('gemini-flash', true);
|
||||
// Verify setActiveModel was called
|
||||
expect(mockConfig.setActiveModel).toHaveBeenCalledWith('gemini-flash');
|
||||
|
||||
// Verify quota error flags are reset
|
||||
expect(mockSetModelSwitchedFromQuotaError).toHaveBeenCalledWith(false);
|
||||
expect(mockConfig.setQuotaErrorOccurred).toHaveBeenCalledWith(false);
|
||||
|
||||
// Check for the "Switched to fallback model" message
|
||||
expect(mockHistoryManager.addItem).toHaveBeenCalledTimes(1);
|
||||
|
||||
Reference in New Issue
Block a user