@@ -139,27 +139,22 @@ it("names how the provider process exited and the stage it failed in, without it
139139 ) ;
140140} ) ;
141141
142- it ( "tells the user to sign in when an ACP agent rejects the session as unauthenticated " , ( ) => {
142+ it ( "tells the user to sign in only when an ACP agent answers auth_required " , ( ) => {
143143 const providerSessionId = ProviderSessionId . make ( "provider-session:private-id" ) ;
144- const sessionOpenFailure = {
144+ const sessionOpenFailure = ( code : number ) => ( {
145145 _tag : "ProviderSessionOpenError" ,
146- providerSessionId,
147146 cause : new ProviderAdapter . ProviderAdapterOpenSessionError ( {
148147 driver : ProviderDriverKind . make ( "acpRegistry" ) ,
149148 providerSessionId,
150- cause : Cause . fail ( {
151- _tag : "AcpRequestError" ,
152- code : - 32000 ,
153- errorMessage : "Authentication required" ,
154- } ) ,
149+ cause : Cause . fail ( { _tag : "AcpRequestError" , code, errorMessage : "Private agent text" } ) ,
155150 } ) ,
156- } ;
151+ } ) ;
157152
158- const known = knownProviderFailureMessage ( sessionOpenFailure ) ;
159- assert . isDefined ( known , "an ACP auth-required failure should have a curated message" ) ;
160- assert . match ( known ?? "" , / s i g n ( e d ) ? [ - ] ? i n | l o g ( g e d ) ? [ - ] ? i n / iu ) ;
161- assert . notInclude ( known ?? "" , providerSessionId ) ;
162- assert . equal ( makeProviderFailure ( { cause : Cause . fail ( sessionOpenFailure ) } ) . message , known ) ;
153+ assert . equal (
154+ makeProviderFailure ( { cause : Cause . fail ( sessionOpenFailure ( - 32000 ) ) } ) . message ,
155+ "The provider needs you to sign in. Sign in from its provider settings or with its own CLI or app, then retry the turn." ,
156+ ) ;
157+ assert . isUndefined ( knownProviderFailureMessage ( sessionOpenFailure ( - 32603 ) ) ) ;
163158} ) ;
164159
165160it ( "keeps unrecognized reasons and provider text out of category messages" , ( ) => {
0 commit comments