@@ -222,6 +222,32 @@ mcpTest.instance(
222222 { config : config ( "test-oauth" ) } ,
223223)
224224
225+ // altimate_change start — upstream_fix: auth status scoped to the configured server URL (anomalyco/opencode#33924)
226+ mcpTest . instance (
227+ "auth status only reports credentials stored for the configured server URL" ,
228+ ( ) =>
229+ Effect . gen ( function * ( ) {
230+ const mcp = yield * MCP . Service
231+ const auth = yield * McpAuth . Service
232+
233+ yield * auth . updateTokens ( "test-status-url" , { accessToken : "legacy-token" } )
234+ expect ( yield * mcp . getAuthStatus ( "test-status-url" ) ) . toBe ( "not_authenticated" )
235+
236+ yield * auth . updateTokens ( "test-status-url" , { accessToken : "old-token" } , "https://old.example.com/mcp" )
237+ expect ( yield * mcp . getAuthStatus ( "test-status-url" ) ) . toBe ( "not_authenticated" )
238+
239+ yield * auth . updateTokens ( "test-status-url" , { accessToken : "current-token" } , "https://example.com/mcp" )
240+ expect ( yield * mcp . getAuthStatus ( "test-status-url" ) ) . toBe ( "authenticated" )
241+
242+ yield * auth . updateTokens ( "test-status-url" , { accessToken : "expired-token" , expiresAt : 1 } , "https://example.com/mcp" )
243+ expect ( yield * mcp . getAuthStatus ( "test-status-url" ) ) . toBe ( "expired" )
244+
245+ expect ( yield * mcp . getAuthStatus ( "not-configured" ) ) . toBe ( "not_authenticated" )
246+ } ) ,
247+ { config : config ( "test-status-url" ) } ,
248+ )
249+ // altimate_change end
250+
225251mcpTest . instance ( "state() generates a new state when none is saved" , ( ) =>
226252 Effect . gen ( function * ( ) {
227253 const auth = yield * McpAuth . Service
0 commit comments