OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
feat: update style for oss of the failed task in the task panel (#1647)
Wallgau64b356e48fa7
diff --git a/frontend/app/globals.css b/frontend/app/globals.cssindex 9fb849a30..fad853f2f 100644--- a/frontend/app/globals.css+++ b/frontend/app/globals.css@@ -63,6 +63,7 @@--badge-foreground: 0 0% 100%; /* #FFFFFF */--radius: 0.5rem;+ --radius-mmd: 13px;--sidebar-background: 0 0% 98%;@@ -88,6 +89,7 @@--failure-message: hsl(var(--foreground));--failure-scroll: #ff6464;--failure-muted: #a66262;+ --failure-component-cause: 0 0% 32%; /* #525252 */}.dark {@@ -156,6 +158,7 @@--failure-message: #ffc9c9cc;--failure-scroll: #ff6464;--failure-muted: #a66262;+ --failure-component-cause: 0 0% 32%; /* #525252 */}/* IBM Light */@@ -238,6 +241,13 @@--badge: 0 0% 22.4%; /* #393939 */--badge-foreground: 0 0% 96%; /* #F4F4F4 */++ --task-status-failed-bg: 357 73% 37%; /* #a2191f */+ --task-status-failed-fg: 357 100% 93%; /* #ffd7d9 */+ --task-status-partial-bg: 26 90% 37%; /* #8a3800 */+ --task-status-partial-fg: 46 100% 90%; /* #fff1c8 */+ --task-status-complete-bg: 137 73% 22%; /* #0e6027 */+ --task-status-complete-fg: 135 59% 80%; /* #a7f0ba */}/* IBM: match OSS switch colors — black track when checked, white thumb always */@@ -329,6 +339,13 @@--badge: 0 0% 32%; /* #525252 */--badge-foreground: 0 0% 96%; /* #F4F4F4 */++ --task-status-failed-bg: 357 73% 37%; /* #a2191f */+ --task-status-failed-fg: 357 100% 93%; /* #ffd7d9 */+ --task-status-partial-bg: 22 78% 32%; /* warm orange */+ --task-status-partial-fg: 46 97% 65%; /* #f1c21b */+ --task-status-complete-bg: 137 73% 22%; /* #0e6027 */+ --task-status-complete-fg: 135 59% 80%; /* #a7f0ba */}/* IBM Settings: section titles (productive heading-04); beats CardTitle utilities */diff --git a/frontend/components/icons/incident-reporter-icon.tsx b/frontend/components/icons/incident-reporter-icon.tsxnew file mode 100644index 000000000..757170118--- /dev/null+++ b/frontend/components/icons/incident-reporter-icon.tsx@@ -0,0 +1,24 @@+import { cn } from "@/lib/utils";++/**+ * Carbon "incident-reporter" glyph (clipboard + alert badge).+ * Inline SVG avoids `@carbon/icons-react` for a single icon.+ * @see https://github.com/carbon-design-system/carbon/tree/main/packages/icons+ */+export function IncidentReporterIcon({+ className,+ ...props+}: React.SVGProps<SVGSVGElement>) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 32 32"+ fill="currentColor"+ aria-hidden+ className={cn("inline-block", className)}+ {...props}+ >+ <path d="M10,13h12v2h-12v-2ZM10,20h8v-2h-8v2ZM10,25h5v-2h-5v2ZM7,7h3v3h12v-3h3v6h2v-6c0-1.1045-.8955-2-2-2h-3v-1c0-1.1045-.8955-2-2-2h-8c-1.1045,0-2,.8955-2,2v1h-3c-1.1045,0-2,.8955-2,2v21c0,1.1045.8955,2,2,2h5v-2h-5V7ZM12,4h8v4h-8v-4ZM29.9108,28.9355l-6.2831-11.5649c-.2739-.4941-.9829-.4941-1.2568,0l-6.2831,11.5649c-.2607.48.0862,1.0645.6316,1.0645h12.5599c.5453,0,.8923-.5845.6315-1.0645ZM22.2493,21h1.5v4h-1.5v-4ZM22.9993,28c-.5522,0-.9993-.4478-.9993-1s.4478-1,1-1,1,.4478,1,1-.4485,1-1.0007,1Z" />+ </svg>+ );+}diff --git a/frontend/components/task-collapsible-section.tsx b/frontend/components/task-collapsible-section.tsxindex e7c28068c..fc0f081f1 100644--- a/frontend/components/task-collapsible-section.tsx+++ b/frontend/components/task-collapsible-section.tsx@@ -33,14 +33,14 @@ export function TaskCollapsibleSection<T>({><h3 className="font-semibold text-sm flex items-center gap-2 text-muted-foreground">{title}- <span className="inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted-foreground text-[10px] font-semibold text-background">+ <span className="inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-muted-foreground text-xxs font-semibold text-background">{items.length}</span></h3>{isOpen ? (- <ChevronDown className="h-[14px] w-[14px] text-foreground" />+ <ChevronDown className="size-3.5 text-foreground" />) : (- <ChevronUp className="h-[14px] w-[14px] text-foreground" />+ <ChevronUp className="size-3.5 text-foreground" />)}</button>diff --git a/frontend/components/task-error-content.tsx b/frontend/components/task-error-content.tsxindex 34266bea2..fbd291403 100644--- a/frontend/components/task-error-content.tsx+++ b/frontend/components/task-error-content.tsx@@ -1,16 +1,26 @@"use client";-import { ArrowDown, ArrowUp, ChevronDown, XCircle } from "lucide-react";-import { useEffect, useMemo, useState } from "react";+import { AlertCircle, ChevronDown, Flag, XCircle } from "lucide-react";+import { useMemo, useState } from "react";+import { IncidentReporterIcon } from "@/components/icons/incident-reporter-icon";import {Accordion,AccordionContent,AccordionItem,AccordionTrigger,} from "@/components/ui/accordion";+import { useIsCloudBrand } from "@/contexts/brand-context";import { type Task } from "@/contexts/task-context";-import { getFailedFileEntries } from "@/lib/task-utils";+import { displayFileTaskError } from "@/lib/task-error-display";+import {+ getFailedFileCount,+ getFailedFileEntries,+ getSuccessfulFileCount,+ isCompletedTotalFailure,+ isTerminalFailedTask,+} from "@/lib/task-utils";import { formatTaskTimestamp, parseTimestamp } from "@/lib/time-utils";+import { cn } from "@/lib/utils";interface TaskErrorContentProps {task: Task;@@ -18,7 +28,6 @@ interface TaskErrorContentProps {nowMs?: number;showHeader?: boolean;defaultExpanded?: boolean;- expandTrigger?: number;}export function TaskErrorContent({@@ -27,126 +36,199 @@ export function TaskErrorContent({nowMs = Date.now(),showHeader = true,defaultExpanded = false,- expandTrigger = 0,}: TaskErrorContentProps) {- const [isExpanded, setIsExpanded] = useState(defaultExpanded);- useEffect(() => {- if (defaultExpanded) {- setIsExpanded(true);- }- }, [defaultExpanded, expandTrigger]);+ const isCloudBrand = useIsCloudBrand();+ const [accordionValue, setAccordionValue] = useState(+ defaultExpanded ? "failed-files" : "",+ );+ const isExpanded = accordionValue === "failed-files";+const failedEntries = useMemo(() => getFailedFileEntries(task), [task]);- const failedCount = task.failed_files ?? failedEntries.length;- const successCount = task.successful_files ?? 0;+ const failedCount = getFailedFileCount(task);+ const successCount = getSuccessfulFileCount(task);const timestamp =parseTimestamp(task.created_at) ?? parseTimestamp(task.updated_at);- const statusLabel = "INCOMPLETE";- const statusPillClassName =- "text-destructive border-failure-pill bg-failure-soft";+ const isFailedStatus =+ isTerminalFailedTask(task) || isCompletedTotalFailure(task);+ const statusLabel = isFailedStatus ? "Failed" : "Complete";+ // Pill colors: failed (red) vs partial success (amber/orange), each with IBM tokens or OSS borders.+ const statusPillClassName = cn(+ "shrink-0 rounded-full px-2 py-1 text-xs",+ isFailedStatus+ ? isCloudBrand+ ? "border-0 bg-task-status-failed text-task-status-failed-foreground"+ : "border border-failure-pill bg-failure-soft text-destructive"+ : isCloudBrand+ ? "border-0 bg-task-status-partial text-task-status-partial-foreground"+ : "border border-brand-amber-30 bg-brand-amber-10 text-brand-amber",+ );if (failedCount <= 0 && failedEntries.length === 0) {return null;}+ const ossIconColumn = showHeader && !isCloudBrand;++ const accordionTrigger = (+ <div className="flex w-full min-w-0 items-center justify-between gap-2">+ <div className="flex min-w-0 items-center gap-1">+ <span className="text-xs">+ {successCount} success · {failedCount} failed+ </span>+ <ChevronDown className="size-4 shrink-0 transition-transform group-data-[state=open]:rotate-180" />+ </div>+ <button+ type="button"+ aria-label="Report incident"+ className="inline-flex shrink-0 items-center justify-center text-muted-foreground hover:text-foreground"+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ }}+ onPointerDown={(event) => event.stopPropagation()}+ >+ <IncidentReporterIcon className="size-4" />+ </button>+ </div>+ );+return (<div- className={- showHeader- ? "flex flex-col gap-1 border-t border-muted w-full hover:bg-muted/60 transition-colors px-4 py-2"- : ""- }+ className={cn(+ "w-full",+ showHeader &&+ cn(+ "py-mmd px-4 transition-colors hover:bg-muted/60",+ isCloudBrand+ ? "border-t border-muted"+ : "rounded-mmd border border-muted",+ ),+ !showHeader && "pt-2",+ )}>- {showHeader && (- <>- <div className="flex items-center justify-between gap-2 min-w-0">- <div className="flex items-center gap-2 min-w-0">- <XCircle className="h-5 w-5 text-destructive shrink-0" />- <p className="text-mmd truncate">- Task {task.task_id.slice(0, 8)}...+ <div className="flex w-full min-w-0 flex-col gap-1">+ {showHeader && (+ <div+ className={cn("flex min-w-0 w-full", ossIconColumn && "gap-2.5")}+ >+ {ossIconColumn &&+ (isFailedStatus ? (+ <XCircle+ className="size-5 shrink-0 text-destructive"+ aria-hidden+ />+ ) : (+ <AlertCircle+ className="size-5 shrink-0 text-brand-amber"+ aria-hidden+ />+ ))}+ <div className="flex min-w-0 flex-1 flex-col gap-1">+ <div className="flex min-w-0 items-center justify-between gap-1.5">+ <p className="text-mmd truncate">+ Task {task.task_id.slice(0, 8)}...+ </p>+ {!isExpanded && (+ <p className={statusPillClassName}>{statusLabel}</p>+ )}+ </div>+ <p className="min-h-4 text-xxs leading-4 text-muted-foreground whitespace-nowrap">+ {formatTaskTimestamp(timestamp, mode, nowMs)}</p></div>- {!isExpanded && (- <p- className={`text-xs shrink-0 border rounded-full px-2 py-1 ${statusPillClassName}`}- >- {statusLabel}- </p>- )}</div>+ )}- <div className="flex flex-col justify-between gap-1">- <p className="text-xxs text-muted-foreground whitespace-nowrap leading-4 min-h-4">- {formatTaskTimestamp(timestamp, mode, nowMs)}- </p>- </div>- </>- )}-- <Accordion- type="single"- collapsible- className="border-0"- value={isExpanded ? "failure-log" : undefined}- onValueChange={(value) => setIsExpanded(Boolean(value))}- >- <AccordionItem value="failure-log" className="border-0 rounded-none">- <AccordionTrigger className="group px-0 py-0 text-sm text-destructive hover:text-destructive/80 transition-colors [&>svg:first-child]:hidden">- <div className="flex items-center gap-1">- <span className="text-muted-foreground text-xs">- {successCount} success,- </span>- <span className="text-destructive text-xs">- {failedCount} failed- </span>- <ChevronDown className="h-4 w-4 text-destructive transition-transform group-data-[state=open]:rotate-180" />- </div>- </AccordionTrigger>- <AccordionContent className="pt-2 pb-0">- <div className="rounded-xl border border-destructive/20 bg-failure-soft p-3">- <p className="text-xs font-medium text-failure-log mb-2 sticky top-0">- Failure Log{" "}- <span className="text-failure-muted">- ({failedCount} of {failedCount} pending)- </span>- </p>- <div className="max-h-56 overflow-y-auto flex flex-col gap-2">+ <Accordion+ type="single"+ collapsible+ className="w-full rounded-mmd border-0"+ value={accordionValue}+ onValueChange={(value) =>+ setAccordionValue(value === "failed-files" ? "failed-files" : "")+ }+ >+ <AccordionItem value="failed-files" className="border-0 rounded-none">+ <AccordionTrigger className="group px-0 py-0 text-sm text-muted-foreground hover:text-foreground transition-colors [&>svg:first-child]:hidden">+ {ossIconColumn ? (+ <div className="flex w-full min-w-0 gap-2.5">+ <div className="size-5 shrink-0" aria-hidden />+ <div className="min-w-0 flex-1">{accordionTrigger}</div>+ </div>+ ) : (+ accordionTrigger+ )}+ </AccordionTrigger>+ <AccordionContent className="w-full p-0 pt-2">+ <div className="flex w-full flex-col gap-2">{failedEntries.map(([filePath, fileInfo], index) => {const fileName =fileInfo.filename || filePath.split("/").pop() || filePath;- const message =+ const rawError =typeof fileInfo.error === "string" && fileInfo.error.trim()? fileInfo.error.trim()- : task.error || "Unknown error";+ : task.error;+ const { line, componentCause } =+ displayFileTaskError(rawError);return (<divkey={`${task.task_id}-${filePath}-${index}`}- className="space-y-1"+ className={cn(+ "task-failed-file-card min-w-0",+ isCloudBrand+ ? "flex flex-col items-start gap-2 self-stretch rounded-none rounded-r border-l-[1.5px] border-l-destructive bg-border p-2"+ : "flex flex-col gap-1 rounded border-destructive/20 bg-failure-soft py-mmd px-4",+ )}>- <p className="text-xs text-failure-file font-semibold truncate">- {">"} {fileName}+ <p+ className={cn(+ "w-full truncate text-xs",+ isCloudBrand+ ? "font-normal text-foreground"+ : "font-semibold text-failure-file",+ )}+ >+ {fileName}</p>- <p className="text-xs text-failure-message break-words">- {message}+ <p+ className={cn(+ "w-full truncate text-xs",+ isCloudBrand+ ? "text-muted-foreground"+ : "text-failure-message",+ )}+ title={rawError}+ >+ {line}</p>+ {componentCause ? (+ <div className="flex min-w-0 items-center gap-1">+ <Flag+ className="size-3 shrink-0 text-destructive"+ aria-hidden+ />+ <span+ className={cn(+ "truncate text-xs",+ isCloudBrand+ ? "text-muted-foreground"+ : "text-failure-component-cause",+ )}+ >+ {componentCause}+ </span>+ </div>+ ) : null}</div>);})}</div>- {failedCount > 1 && (- <div className="mt-2 text-[9px] text-failure-scroll/40 flex items-center justify-center gap-1">- <div className="flex items-center gap-0">- <ArrowUp className="h-2 w-2" />- <ArrowDown className="h-2 w-2" />- </div>- <span>scroll · {failedCount} errors</span>- </div>- )}- </div>- </AccordionContent>- </AccordionItem>- </Accordion>+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ </div></div>);}diff --git a/frontend/components/task-notification-menu.tsx b/frontend/components/task-notification-menu.tsxindex d88005bdb..f2a2ea4fc 100644--- a/frontend/components/task-notification-menu.tsx+++ b/frontend/components/task-notification-menu.tsx@@ -22,11 +22,18 @@ import {CardHeader,CardTitle,} from "@/components/ui/card";+import { useIsCloudBrand } from "@/contexts/brand-context";import { Task, useTask } from "@/contexts/task-context";-import { hasFailedFileEntries, isTerminalFailedTask } from "@/lib/task-utils";+import {+ hasFailedFileEntries,+ isCompletedTotalFailure,+ isTerminalFailedTask,+} from "@/lib/task-utils";import { parseTimestampMs } from "@/lib/time-utils";+import { cn } from "@/lib/utils";export function TaskNotificationMenu() {+ const isCloudBrand = useIsCloudBrand();const {tasks,isFetching,@@ -81,11 +88,6 @@ export function TaskNotificationMenu() {}),[tasks],);- const mostRecentFailureTaskId =- terminalTasks.find(- (task) => isTerminalFailedTask(task) || hasFailedFileEntries(task),- )?.task_id ?? null;-// Ensure selected task is visible in the past tasks section.useEffect(() => {if (!selectedTaskId) return;@@ -103,16 +105,23 @@ export function TaskNotificationMenu() {// Don't render if menu is closedif (!isMenuOpen) return null;- const getTaskIcon = (status: Task["status"], hasFailedFiles = false) => {+ const getTaskIcon = (+ status: Task["status"],+ hasFailedFiles = false,+ isTotalFailure = false,+ ) => {switch (status) {case "completed":if (hasFailedFiles) {+ if (isTotalFailure) {+ return <XCircle className="size-4 text-destructive" />;+ }return <AlertCircle className="h-4 w-4 text-brand-amber" />;}return <CheckCircle className="h-4 w-4 text-green-500" />;case "failed":case "error":- return <XCircle className="h-4 w-4 text-red-500" />;+ return <XCircle className="size-4 text-destructive" />;case "pending":return <Clock className="h-4 w-4 text-yellow-500" />;case "running":@@ -123,25 +132,61 @@ export function TaskNotificationMenu() {}};- const getStatusBadge = (status: Task["status"], hasFailedFiles = false) => {+ const pastTaskRowClass = cn(+ "w-full py-mmd px-4 transition-colors hover:bg-muted/60",+ isCloudBrand ? "border-t border-muted" : "rounded-mmd border border-muted",+ );++ const statusBadgeBase = "shrink-0 rounded-full px-2 py-1 text-xs font-normal";++ const getStatusBadge = (+ status: Task["status"],+ hasFailedFiles = false,+ isTotalFailure = false,+ ) => {switch (status) {case "completed":+ if (hasFailedFiles && isTotalFailure) {+ return (+ <Badge+ variant="outline"+ className={cn(+ statusBadgeBase,+ isCloudBrand+ ? "border-0 bg-task-status-failed text-task-status-failed-foreground"+ : "bg-red-500/10 text-red-500 border-red-500/20",+ )}+ >+ FAILED+ </Badge>+ );+ }if (hasFailedFiles) {return (<Badgevariant="outline"- className="rounded-[8px] bg-brand-amber-10 text-brand-amber border-brand-amber-30"+ className={cn(+ statusBadgeBase,+ isCloudBrand+ ? "border-0 bg-task-status-partial text-task-status-partial-foreground"+ : "bg-brand-amber-10 text-brand-amber border-brand-amber-30",+ )}>- COMPLETED+ Complete</Badge>);}return (<Badgevariant="outline"- className="rounded-[8px] bg-green-500/10 text-green-500 border-green-500/20"+ className={cn(+ statusBadgeBase,+ isCloudBrand+ ? "border-0 bg-task-status-complete text-task-status-complete-foreground"+ : "border border-green-500/20 bg-green-500/10 text-green-500",+ )}>- COMPLETED+ Complete</Badge>);case "failed":@@ -149,16 +194,24 @@ export function TaskNotificationMenu() {return (<Badgevariant="outline"- className="rounded-[8px] bg-red-500/10 text-red-500 border-red-500/20"+ className={cn(+ statusBadgeBase,+ isCloudBrand+ ? "border-0 bg-task-status-failed text-task-status-failed-foreground"+ : "bg-red-500/10 text-red-500 border-red-500/20",+ )}>- INCOMPLETE+ FAILED</Badge>);case "pending":return (<Badgevariant="outline"- className="rounded-[8px] bg-yellow-500/10 text-yellow-500 border-yellow-500/20"+ className={cn(+ statusBadgeBase,+ "bg-yellow-500/10 text-yellow-500 border-yellow-500/20",+ )}>Pending</Badge>@@ -168,7 +221,10 @@ export function TaskNotificationMenu() {return (<Badgevariant="outline"- className="rounded-[8px] bg-blue-500/10 text-blue-500 border-blue-500/20"+ className={cn(+ statusBadgeBase,+ "bg-blue-500/10 text-blue-500 border-blue-500/20",+ )}>Processing</Badge>@@ -177,7 +233,10 @@ export function TaskNotificationMenu() {return (<Badgevariant="outline"- className="rounded-[8px] bg-gray-500/10 text-gray-500 border-gray-500/20"+ className={cn(+ statusBadgeBase,+ "bg-gray-500/10 text-gray-500 border-gray-500/20",+ )}>Unknown</Badge>@@ -266,7 +325,9 @@ export function TaskNotificationMenu() {};return (- <div className="h-full bg-background">+ <div+ className={cn("h-full bg-background", isCloudBrand && "ibm-tasks-panel")}+ ><div className="flex flex-col h-full"><TaskPanelHeaderactiveCount={activeTasks.length}@@ -278,26 +339,36 @@ export function TaskNotificationMenu() {<div className="flex-1 overflow-y-auto">{/* Active Tasks */}{activeTasks.length > 0 && (- <div className="px-4 py-2 space-y-3">+ <div className="flex flex-col gap-2 p-4"><h4 className="text-sm font-medium text-muted-foreground">Active Tasks</h4>{activeTasks.map((task) => {const progress = formatTaskProgress(task);+ const hasFailedFiles = hasFailedFileEntries(task);const showCancel =task.status === "pending" ||task.status === "running" ||task.status === "processing";+ const showTaskIcon =+ !isCloudBrand ||+ task.status !== "completed" ||+ hasFailedFiles;return (<Cardkey={task.task_id}- className="bg-card/50 border-0 shadow-none"+ className="bg-card/50 border-0 shadow-none py-mmd px-4">- <CardHeader className="pb-2">+ <CardHeader className="p-0 pb-2"><div className="flex items-center justify-between"><CardTitle className="text-sm flex items-center gap-2">- {getTaskIcon(task.status)}+ {showTaskIcon &&+ getTaskIcon(+ task.status,+ hasFailedFiles,+ isCompletedTotalFailure(task),+ )}Task {task.task_id.substring(0, 8)}...</CardTitle></div>@@ -311,7 +382,7 @@ export function TaskNotificationMenu() {</CardDescription></CardHeader>{(progress || showCancel) && (- <CardContent className="pt-0">+ <CardContent className="p-0 pt-0">{progress && (<div className="space-y-2"><div className="text-xs text-muted-foreground">@@ -363,18 +434,18 @@ export function TaskNotificationMenu() {</Button></div>)}- {hasFailedFileEntries(task) && (+ {hasFailedFiles && (<div className="mt-3"><TaskErrorContent+ key={+ selectedTaskId === task.task_id+ ? `${task.task_id}-${selectedTaskTrigger}`+ : task.task_id+ }task={task}mode="recent"showHeader={false}- defaultExpanded={true}- expandTrigger={- selectedTaskId === task.task_id- ? selectedTaskTrigger- : 0- }+ defaultExpanded={selectedTaskId === task.task_id}/></div>)}@@ -395,35 +466,42 @@ export function TaskNotificationMenu() {onToggle={() => setIsPastOpen((prev) => !prev)}emptyText="No past tasks."containerClassName=""- contentClassName="transition-all duration-200"+ contentClassName={cn(+ "flex flex-col transition-all duration-200",+ isCloudBrand+ ? "p-0 [&>*:last-child]:border-b [&>*:last-child]:border-muted"+ : "gap-2 p-4 pt-2",+ )}renderItem={(task) => {const progress = formatTaskProgress(task);const hasFailedFiles = hasFailedFileEntries(task);- const shouldExpandDetails =- selectedTaskId === task.task_id ||- (!selectedTaskId && task.task_id === mostRecentFailureTaskId);+ const isTotalFailure = isCompletedTotalFailure(task);+ const shouldExpandDetails = selectedTaskId === task.task_id;- if (isTerminalFailedTask(task)) {+ // Same full card as total failure; partial only differs inside (Complete pill / amber icon).+ if (+ isTerminalFailedTask(task) ||+ isTotalFailure ||+ hasFailedFiles+ ) {return (<TaskErrorContent- key={task.task_id}+ key={+ shouldExpandDetails+ ? `${task.task_id}-${selectedTaskTrigger}`+ : task.task_id+ }task={task}mode="past"defaultExpanded={shouldExpandDetails}- expandTrigger={- shouldExpandDetails ? selectedTaskTrigger : 0- }/>);}return (- <div- key={task.task_id}- className="px-4 py-2 hover:bg-muted/50 transition-colors"- >+ <div key={task.task_id} className={pastTaskRowClass}><div className="flex items-start gap-3">- {getTaskIcon(task.status, hasFailedFiles)}+ {!isCloudBrand && getTaskIcon(task.status)}<div className="flex-1 min-w-0"><div className="text-xs font-medium truncate">Task {task.task_id.substring(0, 8)}...@@ -436,37 +514,20 @@ export function TaskNotificationMenu() {</span>)}</div>- {task.status === "completed" &&- progress?.detailed &&- !hasFailedFiles && (- <div className="text-xs text-muted-foreground">- {progress.detailed.successful} success,{" "}- {progress.detailed.failed} failed- {(progress.detailed.running || 0) > 0 && (- <span>- , {progress.detailed.running} running- </span>- )}- </div>- )}+ {task.status === "completed" && progress?.detailed && (+ <div className="text-xs text-muted-foreground">+ {progress.detailed.successful} success,{" "}+ {progress.detailed.failed} failed+ {(progress.detailed.running || 0) > 0 && (+ <span>, {progress.detailed.running} running</span>+ )}+ </div>+ )}</div><div className="self-start pt-0.5">- {getStatusBadge(task.status, hasFailedFiles)}+ {getStatusBadge(task.status)}</div></div>- {hasFailedFiles && (- <div className="ml-7">- <TaskErrorContent- task={task}- mode="past"- showHeader={false}- defaultExpanded={shouldExpandDetails}- expandTrigger={- shouldExpandDetails ? selectedTaskTrigger : 0- }- />- </div>- )}</div>);}}diff --git a/frontend/components/tasks_details.tsx b/frontend/components/tasks_details.tsxindex 8a9d2f3ae..f6f923453 100644--- a/frontend/components/tasks_details.tsx+++ b/frontend/components/tasks_details.tsx@@ -2,15 +2,18 @@ import { useEffect, useMemo, useState } from "react";import { TaskCollapsibleSection } from "@/components/task-collapsible-section";import { TaskErrorContent } from "@/components/task-error-content";import { TaskPanelHeader } from "@/components/task-panel-header";+import { useIsCloudBrand } from "@/contexts/brand-context";import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context";import { type Task } from "@/contexts/task-context";import { parseTimestampMs } from "@/lib/time-utils";+import { cn } from "@/lib/utils";interface FailedTasksInfoProps {failedTasks: Task[];}export const FailedTasksInfo = ({ failedTasks }: FailedTasksInfoProps) => {+ const isCloudBrand = useIsCloudBrand();const [openSections, setOpenSections] = useState<Record<"recent" | "past", boolean>>({@@ -76,7 +79,12 @@ export const FailedTasksInfo = ({ failedTasks }: FailedTasksInfoProps) => {);return (- <div className="h-full bg-background border-l overflow-y-auto">+ <div+ className={cn(+ "h-full bg-background border-l overflow-y-auto",+ isCloudBrand && "ibm-tasks-panel",+ )}+ ><TaskPanelHeader onClose={closePanelOnly} />{failedTasks.length === 0 ? (@@ -98,6 +106,12 @@ export const FailedTasksInfo = ({ failedTasks }: FailedTasksInfoProps) => {}))}emptyText={section.emptyText}+ contentClassName={cn(+ "flex flex-col",+ isCloudBrand+ ? "p-0 [&>*:last-child]:border-b [&>*:last-child]:border-muted"+ : "gap-2 p-4",+ )}renderItem={(task) => (<TaskErrorContentkey={`${section.sectionKey}-${task.task_id}`}diff --git a/frontend/contexts/task-context.tsx b/frontend/contexts/task-context.tsxindex 8737deb2e..838e3760b 100644--- a/frontend/contexts/task-context.tsx+++ b/frontend/contexts/task-context.tsx@@ -20,7 +20,12 @@ import {import { useAuth } from "@/contexts/auth-context";import { useOnboardingState } from "@/hooks/use-onboarding-state";import { trackProcessFailure, trackProcessSuccess } from "@/lib/analytics";-import { hasFailedFileEntries, isTerminalFailedTask } from "@/lib/task-utils";+import {+ getFailedFileCount,+ getSuccessfulFileCount,+ hasFailedFileEntries,+ isTerminalFailedTask,+} from "@/lib/task-utils";// Task interface is now imported from useGetTasksQueryexport type { Task };@@ -328,20 +333,32 @@ export function TaskProvider({ children }: { children: React.ReactNode }) {previousTask.status !== "completed" &¤tTask.status === "completed") {- // Task just completed - show success toast with file counts- const successfulFiles = currentTask.successful_files || 0;- const failedFiles = currentTask.failed_files || 0;-- trackProcessSuccess({- processType: "Ingestion",- process: "Document Upload",- category: "Knowledge",- task_id: currentTask.task_id,- total_files: currentTask.total_files,- successful_files: successfulFiles,- failed_files: failedFiles,- duration_seconds: currentTask.duration_seconds,- });+ const successfulFiles = getSuccessfulFileCount(currentTask);+ const failedFiles = getFailedFileCount(currentTask);+ const isTotalFailure = failedFiles > 0 && successfulFiles === 0;++ if (isTotalFailure) {+ trackProcessFailure({+ processType: "Ingestion",+ process: "Document Upload",+ category: "Knowledge",+ task_id: currentTask.task_id,+ total_files: currentTask.total_files,+ failed_files: failedFiles,+ duration_seconds: currentTask.duration_seconds,+ });+ } else {+ trackProcessSuccess({+ processType: "Ingestion",+ process: "Document Upload",+ category: "Knowledge",+ task_id: currentTask.task_id,+ total_files: currentTask.total_files,+ successful_files: successfulFiles,+ failed_files: failedFiles,+ duration_seconds: currentTask.duration_seconds,+ });+ }let description = "";if (failedFiles > 0) {@@ -356,17 +373,27 @@ export function TaskProvider({ children }: { children: React.ReactNode }) {} uploaded successfully`;}if (!isOnboardingActive) {- toast.success("Task completed", {- description,- action: {- label: "View",- onClick: () => {- selectTask(currentTask.task_id);- setIsMenuOpen(true);- setIsRecentTasksExpanded(true);- },+ const toastAction = {+ label: "View",+ onClick: () => {+ selectTask(currentTask.task_id);+ setIsMenuOpen(true);+ setIsRecentTasksExpanded(true);},- });+ };+ if (isTotalFailure) {+ toast.error("Task failed", {+ description: `${failedFiles} file${+ failedFiles !== 1 ? "s" : ""+ } failed`,+ action: toastAction,+ });+ } else {+ toast.success("Task completed", {+ description,+ action: toastAction,+ });+ }}const completedHasFailures = hasFailedFileEntries(currentTask);diff --git a/frontend/lib/task-error-display.ts b/frontend/lib/task-error-display.tsnew file mode 100644index 000000000..782b40502--- /dev/null+++ b/frontend/lib/task-error-display.ts@@ -0,0 +1,93 @@+// Will update when backend is ready (error_summary, failing_step, component_cause).++export const FILE_ERROR_MAX_LINE_LENGTH = 80;++export type TaskErrorComponentCause = "OpenSearch" | "Docling" | "Langflow";++const COMPONENT_CAUSES: ReadonlyArray<{+ keyword: string;+ label: TaskErrorComponentCause;+}> = [+ { keyword: "opensearch", label: "OpenSearch" },+ { keyword: "docling", label: "Docling" },+ { keyword: "langflow", label: "Langflow" },+];++export interface FileTaskErrorDisplay {+ line: string;+ componentCause?: TaskErrorComponentCause;+}++function normalizeErrorText(raw: string): string {+ return raw.replace(/\s+/g, " ").trim();+}++function stripNoisePrefixes(text: string): string {+ return text+ .replace(/^Error running graph:\s*/i, "")+ .replace(/^Error building Component [^:]+:\s*/i, "")+ .trim();+}++function truncateLine(+ text: string,+ maxLength = FILE_ERROR_MAX_LINE_LENGTH,+): string {+ if (text.length <= maxLength) {+ return text;+ }+ return `${text.slice(0, maxLength - 1).trimEnd()}…`;+}++/** Prefer a short clause from long, nested error strings. */+function extractReadableLine(text: string): string {+ const beforeCausedBy = text.split(/\s+caused by:/i)[0]?.trim() ?? text;++ if (beforeCausedBy.length <= FILE_ERROR_MAX_LINE_LENGTH) {+ return beforeCausedBy;+ }++ const colonParts = beforeCausedBy.split(":");+ const lastClause = colonParts[colonParts.length - 1]?.trim();+ if (+ lastClause &&+ lastClause.length >= 10 &&+ lastClause.length <= FILE_ERROR_MAX_LINE_LENGTH+ ) {+ return lastClause;+ }++ return beforeCausedBy;+}++export function detectComponentCause(+ raw: string,+): TaskErrorComponentCause | undefined {+ const lower = raw.toLowerCase();+ for (const { keyword, label } of COMPONENT_CAUSES) {+ if (lower.includes(keyword)) {+ return label;+ }+ }+ return undefined;+}++export function displayFileTaskError(+ raw: string | undefined | null,+): FileTaskErrorDisplay {+ if (!raw?.trim()) {+ return { line: "Unknown error" };+ }++ const normalized = normalizeErrorText(raw);+ const componentCause = detectComponentCause(normalized);++ let line = stripNoisePrefixes(normalized);+ line = truncateLine(extractReadableLine(line));++ if (!line) {+ line = "Unknown error";+ }++ return componentCause ? { line, componentCause } : { line };+}diff --git a/frontend/lib/task-utils.ts b/frontend/lib/task-utils.tsindex 94b441fa9..8f22468d5 100644--- a/frontend/lib/task-utils.ts+++ b/frontend/lib/task-utils.ts@@ -24,6 +24,27 @@ export function isCompletedWithFailures(task: Task): boolean {return task.status === "completed" && hasFailedFileEntries(task);}+export function getSuccessfulFileCount(task: Task): number {+ if (typeof task.successful_files === "number") {+ return task.successful_files;+ }+ return Object.values(task.files || {}).filter(+ (fileInfo) => fileInfo?.status === "completed",+ ).length;+}++export function getFailedFileCount(task: Task): number {+ if (typeof task.failed_files === "number") {+ return task.failed_files;+ }+ return getFailedFileEntries(task).length;+}++/** Completed task with failures and no successful files — treat as failed, not partial success. */+export function isCompletedTotalFailure(task: Task): boolean {+ return isCompletedWithFailures(task) && getSuccessfulFileCount(task) === 0;+}+export function isFailureLikeTask(task: Task): boolean {return isTerminalFailedTask(task) || isCompletedWithFailures(task);}diff --git a/frontend/tailwind.config.ts b/frontend/tailwind.config.tsindex a74c8c8ab..cbed098bc 100644--- a/frontend/tailwind.config.ts+++ b/frontend/tailwind.config.ts@@ -192,12 +192,31 @@ const config = {message: "var(--failure-message)",scroll: "var(--failure-scroll)",muted: "var(--failure-muted)",+ "component-cause": "hsl(var(--failure-component-cause))",},+ "task-status": {+ failed: {+ DEFAULT: "hsl(var(--task-status-failed-bg))",+ foreground: "hsl(var(--task-status-failed-fg))",+ },+ partial: {+ DEFAULT: "hsl(var(--task-status-partial-bg))",+ foreground: "hsl(var(--task-status-partial-fg))",+ },+ complete: {+ DEFAULT: "hsl(var(--task-status-complete-bg))",+ foreground: "hsl(var(--task-status-complete-fg))",+ },+ },+ },+ spacing: {+ mmd: "13px",},borderRadius: {lg: "var(--radius)",md: "calc(var(--radius) - 2px)",sm: "calc(var(--radius) - 4px)",+ mmd: "var(--radius-mmd)",},fontFamily: {sans: ["var(--font-sans)", ...fontFamily.sans],diff --git a/frontend/tests/core/tasks-unified-panel.spec.ts b/frontend/tests/core/tasks-unified-panel.spec.tsindex 73f711a54..7bb57146a 100644--- a/frontend/tests/core/tasks-unified-panel.spec.ts+++ b/frontend/tests/core/tasks-unified-panel.spec.ts@@ -77,13 +77,21 @@ const wireTasksState = async (page: Page, initialTasks: MockTask[]) => {};};-const expandFirstFailureAccordion = async (page: Page) => {- const failureLog = page.getByText("Failure Log").first();- if (await failureLog.isVisible()) {+/** Matches accordion summary, e.g. "1 success · 2 failed". */+const FAILURE_SUMMARY_BUTTON = /\d+\s*success\s*[·,.]\s*\d+\s*failed/i;++const expandFirstFailureAccordion = async (+ page: Page,+ expectedError?: string,+) => {+ if (+ expectedError &&+ (await page.getByText(expectedError).first().isVisible())+ ) {return;}await page- .getByRole("button", { name: /\d+\s*success,\s*\d+\s*failed/i })+ .getByRole("button", { name: FAILURE_SUMMARY_BUTTON }).first().click();};@@ -110,18 +118,17 @@ const openTasksPanel = async (page: Page) => {};const openPastTasksSection = async (page: Page) => {- const failureAccordionTrigger = page.getByRole("button", {- name: /\d+\s*success,\s*\d+\s*failed/i,- });- if (await failureAccordionTrigger.count()) {- return;- }-const pastTasksToggle = page.getByRole("button", { name: /Past Tasks/i });- if (await pastTasksToggle.count()) {+ await expect(pastTasksToggle.first()).toBeVisible({ timeout: 15000 });++ const failureSummary = page.getByRole("button", {+ name: FAILURE_SUMMARY_BUTTON,+ });+ if ((await failureSummary.count()) === 0) {await pastTasksToggle.first().click();}- await expect(failureAccordionTrigger.first()).toBeVisible({ timeout: 15000 });++ await expect(failureSummary.first()).toBeVisible({ timeout: 15000 });};test("completed task with failures keeps failure log in Tasks panel", async ({@@ -178,8 +185,10 @@ test("completed task with failures keeps failure log in Tasks panel", async ({);await openTasksPanel(page);await openPastTasksSection(page);- await expandFirstFailureAccordion(page);- await expect(page.getByText("Failure Log")).toBeVisible();+ await expandFirstFailureAccordion(+ page,+ "Synthetic ingestion failure for test",+ );await expect(page.getByText("Synthetic ingestion failure for test"),).toBeVisible();@@ -228,8 +237,7 @@ test("completed task with failures requires View click to open tasks panel", asy);await openTasksPanel(page);await openPastTasksSection(page);- await expandFirstFailureAccordion(page);- await expect(page.getByText("Failure Log")).toBeVisible();+ await expandFirstFailureAccordion(page, "Auto-open on partial success");await expect(page.getByText("Auto-open on partial success")).toBeVisible();});@@ -274,8 +282,7 @@ test("new failed task auto-opens tasks panel", async ({ page }) => {);await openTasksPanel(page);await openPastTasksSection(page);- await expandFirstFailureAccordion(page);- await expect(page.getByText("Failure Log")).toBeVisible();+ await expandFirstFailureAccordion(page, "Auto-open on failed task");await expect(page.getByText("Auto-open on failed task")).toBeVisible();});@@ -325,6 +332,6 @@ test("unified panel shows all completed tasks in a single past tasks section", aawait openTasksPanel(page);await expect(page.getByText("Task task-new...")).toBeVisible();await expect(page.getByText("Task task-old...")).toBeVisible();- // The most recent failure task auto-expands, hiding its INCOMPLETE pill; the older one stays collapsed.- await expect(page.getByText("INCOMPLETE")).toHaveCount(1);+ // Failure summaries stay collapsed by default; both tasks show the Failed pill.+ await expect(page.getByText("Failed", { exact: true })).toHaveCount(2);});