@@ -726,6 +726,13 @@ const AssistantMessage: FC = () => {
726726 : null ;
727727 return typeof custom ?. sessionId === "string" ? custom . sessionId : null ;
728728 } ) ;
729+ const runStatus = useAuiState ( ( state ) => {
730+ const metadata = state . message . metadata ;
731+ const custom = metadata && typeof metadata === "object" && "custom" in metadata
732+ ? metadata . custom as Record < string , unknown >
733+ : null ;
734+ return typeof custom ?. runStatus === "string" ? custom . runStatus : null ;
735+ } ) ;
729736 const hasPlanToolTrace = phase === "plan" && planToolTrace . length > 0 ;
730737
731738 if ( phase === "progress" ) {
@@ -741,7 +748,7 @@ const AssistantMessage: FC = () => {
741748 >
742749 < div className = "aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed" >
743750 < MessagePrimitive . Parts components = { TOOL_PART_COMPONENTS } />
744- { hasPlanToolTrace ? < PlanToolTraceCard trace = { planToolTrace } isRunning = { isRunning } runId = { runId } sessionId = { sessionId } /> : null }
751+ { hasPlanToolTrace ? < PlanToolTraceCard trace = { planToolTrace } isRunning = { isRunning } runId = { runId } sessionId = { sessionId } runStatus = { runStatus } /> : null }
745752 { experimentProposal ? < ExperimentApprovalCard proposal = { experimentProposal } disabled = { isRunning } /> : null }
746753 < MessageError />
747754 </ div >
@@ -814,17 +821,20 @@ const PlanToolTraceCard: FC<{
814821 isRunning : boolean ;
815822 sessionId : string | null ;
816823 runId : string | null ;
817- } > = ( { trace, isRunning, sessionId, runId } ) => {
824+ runStatus : string | null ;
825+ } > = ( { trace, isRunning, sessionId, runId, runStatus } ) => {
818826 const [ collapsed , setCollapsed ] = useState ( false ) ;
819827 const lines = useMemo (
820828 ( ) => trace . map ( ( entry ) => summarizePlanToolLine ( entry ) ) . filter ( ( line ) => line ) ,
821829 [ trace ] ,
822830 ) ;
823- const statusLabel = trace . some ( ( entry ) => entry . state === "error" || entry . isError )
824- ? "Failed"
825- : isRunning || trace . some ( ( entry ) => entry . state === "running" )
826- ? "In Progress"
827- : "Completed" ;
831+ const statusLabel =
832+ runStatus === "failed" ? "Failed"
833+ : runStatus === "cancelled" ? "Cancelled"
834+ : runStatus === "completed" ? "Completed"
835+ : runStatus === "queued" || runStatus === "running" || isRunning || trace . some ( ( entry ) => entry . state === "running" )
836+ ? "In Progress"
837+ : "Completed" ;
828838
829839 return (
830840 < section className = "aui-agentic-trace" aria-label = "Agentic Search run" >
@@ -841,6 +851,7 @@ const PlanToolTraceCard: FC<{
841851 < span className = { cn (
842852 "aui-agentic-trace-status" ,
843853 statusLabel === "Failed" && "is-error" ,
854+ statusLabel === "Cancelled" && "is-error" ,
844855 statusLabel === "Completed" && "is-complete" ,
845856 ) }
846857 >
0 commit comments