@@ -776,6 +776,44 @@ it.layer(layerTest)("checkOpenCodeProviderStatus", (it) => {
776776} ) ;
777777
778778it . layer ( layerTest ) ( "checkOpenCodeProviderStatus with configured server URL" , ( it ) => {
779+ it . effect . each ( [
780+ "401 Unauthorized" ,
781+ "403 Forbidden" ,
782+ "status=401 body={}" ,
783+ "status=403 body={}" ,
784+ "HTTP 401" ,
785+ "HTTP/1.1 403" ,
786+ ] ) ( "keeps explicit authentication rejection actionable: %s" , ( detail ) =>
787+ Effect . gen ( function * ( ) {
788+ runtimeMock . state . connectionError = new Error ( detail ) ;
789+ const snapshot = yield * checkProvider (
790+ makeOpenCodeSettings ( { serverUrl : "http://127.0.0.1:9999" } ) ,
791+ ) ;
792+
793+ NodeAssert . equal ( snapshot . status , "error" ) ;
794+ NodeAssert . equal ( snapshot . auth . status , "unauthenticated" ) ;
795+ NodeAssert . equal (
796+ snapshot . message ,
797+ "OpenCode server rejected authentication. Check the server URL and password." ,
798+ ) ;
799+ } ) ,
800+ ) ;
801+
802+ it . effect . each ( [ 401 , 403 , 4010 , 4030 ] ) ( "keeps connection failures on port %s retryable" , ( port ) =>
803+ Effect . gen ( function * ( ) {
804+ const serverUrl = `http://127.0.0.1:${ port } ` ;
805+ runtimeMock . state . connectionError = new Error ( `connect ECONNREFUSED 127.0.0.1:${ port } ` ) ;
806+ const snapshot = yield * checkProvider ( makeOpenCodeSettings ( { serverUrl } ) ) ;
807+
808+ NodeAssert . equal ( snapshot . status , "error" ) ;
809+ NodeAssert . equal ( snapshot . auth . status , "unknown" ) ;
810+ NodeAssert . equal (
811+ snapshot . message ,
812+ `Couldn't reach the configured OpenCode server at ${ serverUrl } . Check that the server is running and the URL is correct.` ,
813+ ) ;
814+ } ) ,
815+ ) ;
816+
779817 it . effect ( "routes a configured OpenCode 2 server to the 2.x check, never via 1.x" , ( ) =>
780818 Effect . gen ( function * ( ) {
781819 const settings = makeOpenCodeSettings ( {
0 commit comments