@@ -18,7 +18,6 @@ export class ProfileStatusMonitor {
1818 private intervalId ?: NodeJS . Timeout
1919 private readonly CHECK_INTERVAL = 24 * 60 * 60 * 1000 // 24 hours
2020 private codeWhispererClient ?: CodeWhispererServiceToken
21- private cachedProfileArn ?: string
2221 private static lastMcpState ?: boolean
2322
2423 constructor (
@@ -85,7 +84,8 @@ export class ProfileStatusMonitor {
8584 const response = await retryUtils . retryWithBackoff ( ( ) =>
8685 this . codeWhispererClient ! . getProfile ( { profileArn } )
8786 )
88- const isMcpEnabled = response ?. profile ?. optInFeatures ?. mcpConfiguration ?. toggle === 'ON'
87+ const mcpConfig = response ?. profile ?. optInFeatures ?. mcpConfiguration
88+ const isMcpEnabled = mcpConfig ? mcpConfig . toggle === 'ON' : true
8989
9090 if ( ProfileStatusMonitor . lastMcpState !== isMcpEnabled ) {
9191 ProfileStatusMonitor . lastMcpState = isMcpEnabled
@@ -107,16 +107,9 @@ export class ProfileStatusMonitor {
107107 }
108108
109109 private getProfileArn ( ) : string | undefined {
110- // Use cached value if available
111- if ( this . cachedProfileArn ) {
112- return this . cachedProfileArn
113- }
114-
115110 try {
116- // Get profile ARN from service manager like in agenticChatController
117111 const serviceManager = AmazonQTokenServiceManager . getInstance ( )
118- this . cachedProfileArn = serviceManager . getActiveProfileArn ( )
119- return this . cachedProfileArn
112+ return serviceManager . getActiveProfileArn ( )
120113 } catch ( error ) {
121114 this . logging . debug ( `Failed to get profile ARN: ${ error } ` )
122115 }
0 commit comments