@@ -116,17 +116,20 @@ export const AppStatusBody = ({
116116 analyticsCategory : getAIAnalyticsEvents ( 'APP_STATUS' , appDetails . appType ) ,
117117 }
118118
119- const debugAgentContext = {
120- ...aiAgentContext ,
121- prompt : `Why is application '${ appDetails . appName } ' of '${ appDetails . environmentName } ' env ${ appStatus } ?` ,
122- data : {
123- ...aiAgentContext . data ,
124- ...( debugNode ? { debugNodeKind : debugNode . kind , debugNodeName : debugNode . name } : { } ) ,
125- ...( message ? { debugError : message } : { } ) ,
126- namespace : appDetails . namespace ,
127- status : debugNode ?. health ?. status ?? appStatus ,
128- } ,
129- } as MainContext [ 'debugAgentContext' ]
119+ // Have to add this to handle case of devtron-stack manager and software distribution hub.
120+ const debugAgentContext = aiAgentContext
121+ ? ( {
122+ ...aiAgentContext ,
123+ prompt : `Why is application '${ appDetails . appName } ' of '${ appDetails . environmentName } ' env ${ appStatus } ?` ,
124+ data : {
125+ ...aiAgentContext . data ,
126+ ...( debugNode ? { debugNodeKind : debugNode . kind , debugNodeName : debugNode . name } : { } ) ,
127+ ...( message ? { debugError : message } : { } ) ,
128+ namespace : appDetails . namespace ,
129+ status : debugNode ?. health ?. status ?? appStatus ,
130+ } ,
131+ } as MainContext [ 'debugAgentContext' ] )
132+ : null
130133
131134 return [
132135 {
@@ -139,6 +142,7 @@ export const AppStatusBody = ({
139142 envId = { appDetails . environmentId }
140143 actionItem = {
141144 ExplainWithAIButton &&
145+ debugAgentContext &&
142146 appStatus ?. toLowerCase ( ) !== StatusType . HEALTHY . toLowerCase ( ) &&
143147 ( debugNode || message ) ? (
144148 < ExplainWithAIButton
0 commit comments