Let users know when falling back to flash, and update the error messa… (#12640)

This commit is contained in:
Sehoon Shon
2025-11-06 13:43:21 -05:00
committed by GitHub
parent c585470a71
commit 31b34b11ab
11 changed files with 174 additions and 225 deletions

View File

@@ -127,22 +127,6 @@ describe('handleFallback', () => {
});
});
describe('when handler returns "auth"', () => {
it('should NOT activate fallback mode and return false', async () => {
mockHandler.mockResolvedValue('auth');
const result = await handleFallback(
mockConfig,
MOCK_PRO_MODEL,
AUTH_OAUTH,
);
expect(result).toBe(false);
expect(mockConfig.setFallbackMode).not.toHaveBeenCalled();
expect(logFlashFallback).not.toHaveBeenCalled();
});
});
describe('when handler returns an unexpected value', () => {
it('should log an error and return null', async () => {
mockHandler.mockResolvedValue(null);

View File

@@ -46,7 +46,7 @@ export async function handleFallback(
activateFallbackMode(config, authType);
return false;
case 'auth':
case 'retry_later':
return false;
default:

View File

@@ -10,7 +10,7 @@
export type FallbackIntent =
| 'retry' // Immediately retry the current request with the fallback model.
| 'stop' // Switch to fallback for future requests, but stop the current request.
| 'auth'; // Stop the current request; user intends to change authentication.
| 'retry_later'; // Stop the current request and do not fallback. Intend to try again later with the same model.
/**
* The interface for the handler provided by the UI layer (e.g., the CLI)