@@ -211,6 +211,10 @@ export const mockedFormatBillingErrorMessage = vi.fn(() => "");
211211export const mockedClassifyFailoverReason = vi . fn < ( raw : string ) => FailoverReason | null > (
212212 ( ) => null ,
213213) ;
214+ export const mockedClassifyAssistantFailoverReason = vi . fn (
215+ ( assistant ?: { errorMessage ?: string | null } ) : FailoverReason | null =>
216+ mockedClassifyFailoverReason ( assistant ?. errorMessage ?? "" ) ,
217+ ) ;
214218export const mockedExtractObservedOverflowTokenCount = vi . fn ( ( msg ?: string ) => {
215219 const match = msg ?. match ( / p r o m p t i s t o o l o n g : \s * ( [ \d , ] + ) \s + t o k e n s \s * > \s * [ \d , ] + \s + m a x i m u m / i) ;
216220 return match ?. [ 1 ] ? Number ( match [ 1 ] . replaceAll ( "," , "" ) ) : undefined ;
@@ -384,6 +388,11 @@ export function resetRunOverflowCompactionHarnessMocks(): void {
384388
385389 mockedClassifyFailoverReason . mockReset ( ) ;
386390 mockedClassifyFailoverReason . mockReturnValue ( null ) ;
391+ mockedClassifyAssistantFailoverReason . mockReset ( ) ;
392+ mockedClassifyAssistantFailoverReason . mockImplementation (
393+ ( assistant ?: { errorMessage ?: string | null } ) : FailoverReason | null =>
394+ mockedClassifyFailoverReason ( assistant ?. errorMessage ?? "" ) ,
395+ ) ;
387396 mockedFormatBillingErrorMessage . mockReset ( ) ;
388397 mockedFormatBillingErrorMessage . mockReturnValue ( "" ) ;
389398 mockedFormatAssistantErrorText . mockReset ( ) ;
@@ -624,6 +633,7 @@ export async function loadRunOverflowCompactionHarness(): Promise<{
624633 vi . doMock ( "../embedded-agent-helpers.js" , ( ) => ( {
625634 formatBillingErrorMessage : mockedFormatBillingErrorMessage ,
626635 classifyFailoverReason : mockedClassifyFailoverReason ,
636+ classifyAssistantFailoverReason : mockedClassifyAssistantFailoverReason ,
627637 extractObservedOverflowTokenCount : mockedExtractObservedOverflowTokenCount ,
628638 formatAssistantErrorText : mockedFormatAssistantErrorText ,
629639 isAuthAssistantError : mockedIsAuthAssistantError ,
0 commit comments