AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(platform): show which step failed and why when a run completes with errors (#15419)
Nicholas Tindlecab39bceb7ad
diff --git a/autogpt_platform/backend/backend/copilot/tools/agent_output.py b/autogpt_platform/backend/backend/copilot/tools/agent_output.pyindex 0f0c08a398..40da793466 100644--- a/autogpt_platform/backend/backend/copilot/tools/agent_output.py+++ b/autogpt_platform/backend/backend/copilot/tools/agent_output.py@@ -391,7 +391,13 @@ class AgentOutputTool(BaseTool):# Build appropriate message based on execution statusif execution.status == ExecutionStatus.COMPLETED:message = f"Found execution outputs for agent '{agent.name}'"- health_warning = build_run_health_warning(execution.outputs, node_failures)+ health_warning = build_run_health_warning(+ execution.outputs,+ node_failures,+ failed_node_count=(+ execution.stats.node_error_count if execution.stats else 0+ ),+ )if health_warning:if not isinstance(execution, GraphExecutionWithNodes):health_warning += (diff --git a/autogpt_platform/backend/backend/copilot/tools/agent_output_test.py b/autogpt_platform/backend/backend/copilot/tools/agent_output_test.pyindex a1f62f1973..0b612ec4a2 100644--- a/autogpt_platform/backend/backend/copilot/tools/agent_output_test.py+++ b/autogpt_platform/backend/backend/copilot/tools/agent_output_test.py@@ -10,6 +10,7 @@ from unittest.mock import MagicMockfrom backend.data.execution import (ExecutionStatus,GraphExecution,+ GraphExecutionMeta,GraphExecutionWithNodes,)@@ -24,7 +25,13 @@ def _agent() -> MagicMock:return agent-def _execution(*, with_nodes: bool, outputs: dict, node_executions: list):+def _execution(+ *,+ with_nodes: bool,+ outputs: dict,+ node_executions: list,+ node_error_count: int = 0,+):spec = GraphExecutionWithNodes if with_nodes else GraphExecutionexecution = MagicMock(spec=spec)execution.id = "exec-1"@@ -33,6 +40,7 @@ def _execution(*, with_nodes: bool, outputs: dict, node_executions: list):execution.ended_at = Noneexecution.outputs = outputsexecution.inputs = None+ execution.stats = GraphExecutionMeta.Stats(node_error_count=node_error_count)if with_nodes:execution.node_executions = node_executionsreturn execution@@ -79,6 +87,24 @@ def test_completed_empty_outputs_without_nodes_nudges_details():assert "show_execution_details=true" in response.message+def test_completed_with_output_and_failed_node_warns_without_the_trace():+ """The default call loads no per-node trace. A run that produced output+ while a node failed must still warn, from the run's own failure count."""+ response = AgentOutputTool()._build_response(+ agent=_agent(),+ execution=_execution(+ with_nodes=False,+ outputs={"result": ["partial"]},+ node_executions=[],+ node_error_count=1,+ ),+ available_executions=[],+ session_id="sess-1",+ )+ assert "1 node(s) FAILED despite the COMPLETED" in response.message+ assert "show_execution_details=true" in response.message++def test_healthy_completed_has_no_warning():response = AgentOutputTool()._build_response(agent=_agent(),diff --git a/autogpt_platform/backend/backend/copilot/tools/execution_utils.py b/autogpt_platform/backend/backend/copilot/tools/execution_utils.pyindex 084c4a0c4e..83ac56c91a 100644--- a/autogpt_platform/backend/backend/copilot/tools/execution_utils.py+++ b/autogpt_platform/backend/backend/copilot/tools/execution_utils.py@@ -237,8 +237,14 @@ def summarize_node_failures(def build_run_health_warning(outputs: dict[str, Any] | None,node_failures: list[NodeFailureSummary],+ failed_node_count: int = 0,) -> str | None:- """Warning to include in a COMPLETED-run message, or None if healthy."""+ """Warning to include in a COMPLETED-run message, or None if healthy.++ `failed_node_count` is the run's own tally (`stats.node_error_count`). It+ still flags a failed node when the per-node trace that `node_failures` is+ built from wasn't loaded.+ """if node_failures:details = "; ".join(f"{f['block_name']}: {f['error'] or 'no error detail'}"@@ -250,6 +256,12 @@ def build_run_health_warning("node_executions, fix the agent, and re-verify before reporting ""success.")+ if failed_node_count > 0:+ return (+ f"WARNING: {failed_node_count} node(s) FAILED despite the COMPLETED "+ "status. Treat this run as unsuccessful — inspect node_executions, "+ "fix the agent, and re-verify before reporting success."+ )if not outputs:return ("WARNING: the run COMPLETED but produced no outputs. If this "diff --git a/autogpt_platform/backend/backend/copilot/tools/run_agent.py b/autogpt_platform/backend/backend/copilot/tools/run_agent.pyindex e551f214ff..1a7863686d 100644--- a/autogpt_platform/backend/backend/copilot/tools/run_agent.py+++ b/autogpt_platform/backend/backend/copilot/tools/run_agent.py@@ -1155,7 +1155,13 @@ class RunAgentTool(BaseTool):await _safe_link_to_chat_share(session_id=session_id, execution_id=execution.id)- health_warning = build_run_health_warning(outputs, node_failures)+ health_warning = build_run_health_warning(+ outputs,+ node_failures,+ failed_node_count=(+ completed.stats.node_error_count if completed.stats else 0+ ),+ )if health_warning:message = (f"Agent '{library_agent.name}' finished with status "diff --git a/autogpt_platform/backend/backend/copilot/tools/run_agent_test.py b/autogpt_platform/backend/backend/copilot/tools/run_agent_test.pyindex 33b646e05b..8bb35b4d14 100644--- a/autogpt_platform/backend/backend/copilot/tools/run_agent_test.py+++ b/autogpt_platform/backend/backend/copilot/tools/run_agent_test.py@@ -6,7 +6,11 @@ import orjsonimport pytestfrom backend.copilot.context import set_turn_unattended-from backend.data.execution import ExecutionStatus+from backend.data.execution import (+ ExecutionStatus,+ GraphExecutionMeta,+ GraphExecutionWithNodes,+)from backend.data.model import USER_TIMEZONE_NOT_SETfrom backend.executor.scheduler import GraphExecutionJobInfofrom backend.executor.utils import is_credential_validation_error_message@@ -1663,13 +1667,10 @@ def _completed_run_mocks(outputs: dict,node_executions: list | None = None,detailed_fetch_error: Exception | None = None,+ node_error_count: int = 0,):"""Wire the waited-COMPLETED path: library agent, execution, waiter,outputs, and the detailed per-node trace fetch."""- from unittest.mock import MagicMock-- from backend.data.execution import GraphExecutionWithNodes-lib = MagicMock()lib.graph_id = "graph-1"lib.graph_version = 1@@ -1698,6 +1699,7 @@ def _completed_run_mocks(completed.status = ExecutionStatus.COMPLETEDcompleted.started_at = Nonecompleted.ended_at = None+ completed.stats = GraphExecutionMeta.Stats(node_error_count=node_error_count)mocker.patch("backend.copilot.tools.run_agent.wait_for_execution",AsyncMock(return_value=completed),@@ -1845,6 +1847,22 @@ async def test_detailed_fetch_failure_degrades_to_summary(mocker):assert response.execution.nodes_failed is None[email protected](loop_scope="session")+async def test_detailed_fetch_failure_still_reports_the_runs_failed_nodes(mocker):+ """Without the per-node trace, the run's own failed-node count still keeps+ a COMPLETED run with a failed node from reading as success."""+ _completed_run_mocks(+ mocker,+ outputs={"result": ["ok"]},+ detailed_fetch_error=RuntimeError("db down"),+ node_error_count=1,+ )+ response = await _run_waited(mocker, dry_run=False)++ assert "1 node(s) FAILED despite the COMPLETED" in response.message+ assert "completed successfully" not in response.message++@pytest.mark.asyncio(loop_scope="session")async def test_run_preset_refuses_uninstalled_workflow_for_expert():from backend.copilot.tools.run_agent import RunAgentInputdiff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/__tests__/failed-steps.test.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/__tests__/failed-steps.test.tsxnew file mode 100644index 0000000000..5fb65f3fa6--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/__tests__/failed-steps.test.tsx@@ -0,0 +1,264 @@+import { getGetV2GetSpecificBlocksMockHandler } from "@/app/api/__generated__/endpoints/default/default.msw";+import {+ getGetV1GetExecutionDetailsMockHandler,+ getGetV1ListGraphExecutionsMockHandler,+} from "@/app/api/__generated__/endpoints/graphs/graphs.msw";+import {+ getGetV2GetLibraryAgentMockHandler,+ getGetV2GetLibraryAgentResponseMock,+} from "@/app/api/__generated__/endpoints/library/library.msw";+import { getGetV2ListPresetsMockHandler } from "@/app/api/__generated__/endpoints/presets/presets.msw";+import { getGetV1ListExecutionSchedulesForAGraphMockHandler } from "@/app/api/__generated__/endpoints/schedules/schedules.msw";+import { AgentExecutionStatus } from "@/app/api/__generated__/models/agentExecutionStatus";+import type { BlockInfo } from "@/app/api/__generated__/models/blockInfo";+import type { GraphExecutionMeta } from "@/app/api/__generated__/models/graphExecutionMeta";+import type { NodeExecutionResult } from "@/app/api/__generated__/models/nodeExecutionResult";+import { server } from "@/mocks/mock-server";+import { render, screen, within } from "@/tests/integrations/test-utils";+import { NuqsTestingAdapter } from "nuqs/adapters/testing";+import { expect, test, vi } from "vitest";+import { NewAgentLibraryView } from "../components/NewAgentLibraryView/NewAgentLibraryView";++vi.mock("next/navigation", async (importOriginal) => ({+ ...(await importOriginal<typeof import("next/navigation")>()),+ useParams: () => ({ id: "library-agent" }),+ usePathname: () => "/library/agents/library-agent",+ useRouter: () => ({ push: vi.fn(), replace: vi.fn(), refresh: vi.fn() }),+ useSearchParams: () => new URLSearchParams(),+}));++vi.mock("@/lib/auth/hooks/useAuth", () => ({+ useAuth: () => ({+ user: { id: "user-1", email: "[email protected]" },+ isLoggedIn: true,+ isUserLoading: false,+ }),+}));++vi.mock("@/services/feature-flags/use-get-flag", async (importOriginal) => ({+ ...(await importOriginal<+ typeof import("@/services/feature-flags/use-get-flag")+ >()),+ useGetFlag: () => false,+ useFlagStatus: () => ({ enabled: false, ready: true }),+}));++const GRAPH_ID = "graph-1";+const RUN_ID = "run-1";+const MATCH_BLOCK_ID = "match-block";+const OUTPUT_BLOCK_ID = "output-block";+const REGEX_ERROR =+ "Invalid regex pattern: missing ), unterminated subpattern at position 0";++function makeRun(overrides: Partial<GraphExecutionMeta>): GraphExecutionMeta {+ return {+ id: RUN_ID,+ user_id: "user-1",+ graph_id: GRAPH_ID,+ graph_version: 1,+ inputs: {},+ credential_inputs: {},+ nodes_input_masks: {},+ preset_id: null,+ status: AgentExecutionStatus.COMPLETED,+ started_at: new Date(),+ ended_at: new Date(),+ stats: { node_exec_count: 2, node_error_count: 0 },+ ...overrides,+ };+}++function makeNodeExecution(+ overrides: Partial<NodeExecutionResult>,+): NodeExecutionResult {+ return {+ user_id: "user-1",+ graph_id: GRAPH_ID,+ graph_version: 1,+ graph_exec_id: RUN_ID,+ node_exec_id: "node-exec-match",+ node_id: "node-match",+ block_id: MATCH_BLOCK_ID,+ status: AgentExecutionStatus.COMPLETED,+ input_data: {},+ output_data: {},+ add_time: new Date(),+ queue_time: null,+ start_time: null,+ end_time: null,+ ...overrides,+ };+}++function failedMatchStep() {+ return makeNodeExecution({+ status: AgentExecutionStatus.FAILED,+ output_data: { error: [REGEX_ERROR] },+ });+}++function makeBlock(id: string, name: string): BlockInfo {+ return {+ id,+ name,+ inputSchema: {},+ outputSchema: {},+ costs: [],+ description: "",+ categories: [],+ contributors: [],+ staticOutput: false,+ uiType: "Standard",+ };+}++interface Scenario {+ run: GraphExecutionMeta;+ nodeExecutions: NodeExecutionResult[];+ outputs?: Record<string, unknown[]>;+}++function renderRun({ run, nodeExecutions, outputs = {} }: Scenario) {+ server.use(+ getGetV2GetLibraryAgentMockHandler(+ getGetV2GetLibraryAgentResponseMock({+ id: "library-agent",+ graph_id: GRAPH_ID,+ graph_version: 1,+ name: "Pattern agent",+ input_schema: { type: "object", properties: {} },+ credentials_input_schema: { type: "object", properties: {} },+ has_external_trigger: false,+ trigger_setup_info: null,+ has_sensitive_action: false,+ has_human_in_the_loop: false,+ recommended_schedule_cron: null,+ }),+ ),+ getGetV1ListGraphExecutionsMockHandler({+ executions: [run],+ pagination: {+ total_items: 1,+ total_pages: 1,+ current_page: 1,+ page_size: 20,+ },+ }),+ getGetV1ListExecutionSchedulesForAGraphMockHandler([]),+ getGetV2ListPresetsMockHandler({+ presets: [],+ pagination: {+ total_items: 0,+ total_pages: 0,+ current_page: 1,+ page_size: 100,+ },+ }),+ getGetV1GetExecutionDetailsMockHandler({+ ...run,+ inputs: {},+ outputs,+ node_executions: nodeExecutions,+ }),+ getGetV2GetSpecificBlocksMockHandler([+ makeBlock(MATCH_BLOCK_ID, "MatchTextPatternBlock"),+ makeBlock(OUTPUT_BLOCK_ID, "AgentOutputBlock"),+ ]),+ );++ render(+ <NuqsTestingAdapter searchParams={`activeTab=runs&activeItem=${RUN_ID}`}>+ <NewAgentLibraryView />+ </NuqsTestingAdapter>,+ );+}++test("a completed run with a failed step names the step, shows its error, and is marked in the run list", async () => {+ renderRun({+ run: makeRun({ stats: { node_exec_count: 1, node_error_count: 1 } }),+ nodeExecutions: [failedMatchStep()],+ });++ const failures = await screen.findByTestId("run-failures");+ expect(within(failures).getByText("1 step failed")).toBeDefined();+ expect(await within(failures).findByText("Match Text Pattern")).toBeDefined();+ expect(within(failures).getByText(REGEX_ERROR)).toBeDefined();+ expect(screen.getByText("Completed with errors")).toBeDefined();++ const runItem = await screen.findByTestId(`library-run-item-${RUN_ID}`);+ expect(within(runItem).getByText(/^1 step failed · /)).toBeDefined();+});++test("a run with output and a failed step shows both", async () => {+ renderRun({+ run: makeRun({ stats: { node_exec_count: 3, node_error_count: 1 } }),+ nodeExecutions: [+ failedMatchStep(),+ makeNodeExecution({+ node_exec_id: "node-exec-output",+ node_id: "node-output",+ block_id: OUTPUT_BLOCK_ID,+ output_data: { output: ["partial result"] },+ }),+ ],+ outputs: { answer: ["partial result"] },+ });++ expect(await screen.findByText("partial result")).toBeDefined();+ const failures = screen.getByTestId("run-failures");+ expect(within(failures).getByText(REGEX_ERROR)).toBeDefined();+ expect(within(failures).queryByText("Agent Output")).toBeNull();+});++test("a clean run shows no failure notice and a plain completed state", async () => {+ renderRun({+ run: makeRun({}),+ nodeExecutions: [makeNodeExecution({ output_data: { positive: ["ok"] } })],+ });++ const runItem = await screen.findByTestId(`library-run-item-${RUN_ID}`);+ expect(await screen.findByText("Completed")).toBeDefined();+ expect(screen.queryByTestId("run-failures")).toBeNull();+ expect(screen.queryByText("Completed with errors")).toBeNull();+ expect(within(runItem).queryByText(/step failed/)).toBeNull();+});++test("a completed run that counted a failed step says so even without the step's details", async () => {+ renderRun({+ run: makeRun({ stats: { node_exec_count: 2, node_error_count: 1 } }),+ nodeExecutions: [makeNodeExecution({ output_data: { positive: ["ok"] } })],+ });++ const failures = await screen.findByTestId("run-failures");+ expect(within(failures).getByText("1 step failed")).toBeDefined();+ expect(within(failures).queryByRole("listitem")).toBeNull();+ expect(screen.getByText("Completed with errors")).toBeDefined();+});++test("steps swept to FAILED when the user stops a run are not reported as errors", async () => {+ renderRun({+ run: makeRun({ status: AgentExecutionStatus.TERMINATED }),+ nodeExecutions: [+ makeNodeExecution({ status: AgentExecutionStatus.FAILED }),+ ],+ });++ expect(await screen.findByText("Stopped")).toBeDefined();+ expect(screen.queryByTestId("run-failures")).toBeNull();+});++test("a run that failed without a failed step shows the run's error", async () => {+ renderRun({+ run: makeRun({+ status: AgentExecutionStatus.FAILED,+ stats: { error: "Insufficient balance to run this agent" },+ }),+ nodeExecutions: [],+ });++ const failures = await screen.findByTestId("run-failures");+ expect(within(failures).getByText("This run failed")).toBeDefined();+ expect(+ within(failures).getByText("Insufficient balance to run this agent"),+ ).toBeDefined();+});diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/RunDetailHeader/RunDetailHeader.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/RunDetailHeader/RunDetailHeader.tsxindex 6345c4109d..0bb3facb2b 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/RunDetailHeader/RunDetailHeader.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/RunDetailHeader/RunDetailHeader.tsx@@ -7,6 +7,7 @@ import { RunStatusBadge } from "../SelectedRunView/components/RunStatusBadge";import { FlaskConicalIcon, TimeScheduleIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/components/atoms/Icon/Icon";import { useIsBillingEnabled } from "@/hooks/useIsBillingEnabled";+import { isCompletedWithErrors } from "@/lib/run-health";type Props = {agent: LibraryAgent;@@ -26,7 +27,10 @@ export function RunDetailHeader({ agent, run, scheduleRecurrence }: Props) {<div className="flex min-w-0 flex-1 flex-col items-start gap-3">{run?.status ? (<div className="flex items-center gap-2">- <RunStatusBadge status={run.status} />+ <RunStatusBadge+ status={run.status}+ completedWithErrors={isCompletedWithErrors(run)}+ />{run.is_dry_run && (<div className="inline-flex items-center gap-1 rounded-md bg-amber-50 p-1"><Icondiff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/SelectedRunView.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/SelectedRunView.tsxindex 05da986583..ac2d388504 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/SelectedRunView.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/SelectedRunView.tsx@@ -21,6 +21,7 @@ import { LoadingSelectedContent } from "../LoadingSelectedContent";import { RunDetailCard } from "../RunDetailCard/RunDetailCard";import { RunDetailHeader } from "../RunDetailHeader/RunDetailHeader";import { SelectedViewLayout } from "../SelectedViewLayout";+import { RunFailures } from "./components/RunFailures/RunFailures";import { RunOutputs } from "./components/RunOutputs";import { RunSummary } from "./components/RunSummary";import { SelectedRunActions } from "./components/SelectedRunActions/SelectedRunActions";@@ -103,6 +104,8 @@ export function SelectedRunView({/>)}+ {run ? <RunFailures run={run} /> : null}+<ScrollableTabsdefaultValue={withReviews ? "reviews" : "output"}className="-mt-2 flex flex-col"diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/RunFailures.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/RunFailures.tsxnew file mode 100644index 0000000000..73ce07a080--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/RunFailures.tsx@@ -0,0 +1,88 @@+"use client";++import { AgentExecutionStatus } from "@/app/api/__generated__/models/agentExecutionStatus";+import type { GetV1GetExecutionDetails200 } from "@/app/api/__generated__/models/getV1GetExecutionDetails200";+import { createIconComponent } from "@/components/atoms/Icon/Icon";+import { Skeleton } from "@/components/atoms/Skeleton/Skeleton";+import { Text } from "@/components/atoms/Text/Text";+import {+ Alert,+ AlertDescription,+ AlertTitle,+} from "@/components/molecules/Alert/Alert";+import { ShowMoreText } from "@/components/molecules/ShowMoreText/ShowMoreText";+import { describeFailedSteps } from "@/lib/run-health";+import { Alert02Icon, CancelCircleIcon } from "@hugeicons/core-free-icons";+import { useRunFailures } from "./useRunFailures";++const WarningIcon = createIconComponent(Alert02Icon);+const FailedIcon = createIconComponent(CancelCircleIcon);++const ERROR_PREVIEW_LIMIT = 300;+const ERROR_CLASS_NAME = "whitespace-pre-wrap break-words !text-zinc-800";++interface Props {+ run: GetV1GetExecutionDetails200;+}++export function RunFailures({ run }: Props) {+ const { steps, failedStepCount, runError, isLoadingNames } =+ useRunFailures(run);++ if (failedStepCount === 0 && !runError) return null;++ const runFailed = run.status === AgentExecutionStatus.FAILED;++ return (+ <div className="px-4" data-testid="run-failures">+ <Alert+ variant={runFailed ? "error" : "warning"}+ icon={runFailed ? FailedIcon : WarningIcon}+ className="[&>svg]:top-3 [&>svg]:translate-y-0"+ >+ <AlertTitle>+ {failedStepCount > 0+ ? describeFailedSteps(failedStepCount)+ : "This run failed"}+ </AlertTitle>+ <AlertDescription className="flex flex-col gap-3">+ {run.status === AgentExecutionStatus.COMPLETED ? (+ <Text variant="small" className="!text-zinc-600">+ The run still finished, so its output may be incomplete.+ </Text>+ ) : null}+ {runError ? (+ <ShowMoreText+ variant="small"+ previewLimit={ERROR_PREVIEW_LIMIT}+ className={ERROR_CLASS_NAME}+ >+ {runError}+ </ShowMoreText>+ ) : steps.length > 0 ? (+ <ul className="flex flex-col gap-3">+ {steps.map((step) => (+ <li key={step.id} className="flex flex-col gap-1">+ {step.name ? (+ <Text variant="body-medium">{step.name}</Text>+ ) : isLoadingNames ? (+ <Skeleton className="h-5 w-32" />+ ) : (+ <Text variant="body-medium">Unknown step</Text>+ )}+ <ShowMoreText+ variant="small"+ previewLimit={ERROR_PREVIEW_LIMIT}+ className={ERROR_CLASS_NAME}+ >+ {step.error}+ </ShowMoreText>+ </li>+ ))}+ </ul>+ ) : null}+ </AlertDescription>+ </Alert>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/helpers.tsnew file mode 100644index 0000000000..39c5fb1bd4--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/helpers.ts@@ -0,0 +1,39 @@+import { AgentExecutionStatus } from "@/app/api/__generated__/models/agentExecutionStatus";+import type { GetV1GetExecutionDetails200 } from "@/app/api/__generated__/models/getV1GetExecutionDetails200";+import { beautifyString } from "@/lib/utils";++export interface FailedStep {+ id: string;+ blockID: string;+ error: string;+}++// Every step that errors records its message as an "error" output. Steps+// swept to FAILED because the whole run ended have none, so they're skipped.+export function getFailedSteps(run: GetV1GetExecutionDetails200): FailedStep[] {+ if (!("node_executions" in run)) return [];+ return run.node_executions.flatMap((nodeExecution) => {+ const error = nodeExecution.output_data.error?.[0];+ if (nodeExecution.status !== AgentExecutionStatus.FAILED || error == null) {+ return [];+ }+ return [+ {+ id: nodeExecution.node_exec_id,+ blockID: nodeExecution.block_id,+ error: typeof error === "string" ? error : JSON.stringify(error),+ },+ ];+ });+}++export function getRunError(run: GetV1GetExecutionDetails200) {+ if (run.status !== AgentExecutionStatus.FAILED) return null;+ return run.stats?.error || null;+}++export function formatStepName(blockName: string) {+ return beautifyString(blockName)+ .replace(/ Block$/, "")+ .trim();+}diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/useRunFailures.ts b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/useRunFailures.tsnew file mode 100644index 0000000000..aa2740bdb9--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunFailures/useRunFailures.ts@@ -0,0 +1,40 @@+import { useGetV2GetSpecificBlocks } from "@/app/api/__generated__/endpoints/default/default";+import type { GetV1GetExecutionDetails200 } from "@/app/api/__generated__/models/getV1GetExecutionDetails200";+import { okData } from "@/app/api/helpers";+import { getFailedStepCount, isCompletedWithErrors } from "@/lib/run-health";+import { formatStepName, getFailedSteps, getRunError } from "./helpers";++export function useRunFailures(run: GetV1GetExecutionDetails200) {+ const failedSteps = getFailedSteps(run);+ const blockIDs = Array.from(new Set(failedSteps.map((step) => step.blockID)));++ const blocksQuery = useGetV2GetSpecificBlocks(+ { block_ids: blockIDs },+ {+ query: {+ enabled: blockIDs.length > 0,+ select: okData,+ staleTime: Infinity,+ },+ },+ );++ const steps = failedSteps.map((step) => {+ const block = blocksQuery.data?.find(({ id }) => id === step.blockID);+ return { ...step, name: block ? formatStepName(block.name) : null };+ });++ // The run's own tally still counts a failed step whose details are missing,+ // which keeps this notice in step with the run list and the status badge.+ const countedFailures = isCompletedWithErrors(run)+ ? getFailedStepCount(run)+ : 0;+ const failedStepCount = Math.max(steps.length, countedFailures);++ return {+ steps,+ failedStepCount,+ runError: failedStepCount > 0 ? null : getRunError(run),+ isLoadingNames: blocksQuery.isLoading,+ };+}diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunStatusBadge.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunStatusBadge.tsxindex 56f90d3f42..72f6b8e232 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunStatusBadge.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/selected-views/SelectedRunView/components/RunStatusBadge.tsx@@ -4,6 +4,7 @@ import { Text } from "@/components/atoms/Text/Text";import { cn } from "@/lib/utils";import {Alert01Icon,+ Alert02Icon,AlertCircleIcon,CancelCircleIcon,CheckmarkCircle02Icon,@@ -59,24 +60,38 @@ const statusIconMap: Record<AgentExecutionStatus, StatusIconMap> = {},};+const completedWithErrorsStyle: StatusIconMap = {+ icon: <Icon icon={Alert02Icon} size={16} className="text-amber-700" />,+ bgColor: "bg-amber-50",+ textColor: "!text-amber-700",+};+type Props = {status: AgentExecutionStatus;+ completedWithErrors?: boolean;};-export function RunStatusBadge({ status }: Props) {+export function RunStatusBadge({ status, completedWithErrors = false }: Props) {+ const style = completedWithErrors+ ? completedWithErrorsStyle+ : statusIconMap[status];+ const label = completedWithErrors+ ? "Completed with errors"+ : getRunStatusInfo(status).label;+return (<divclassName={cn("inline-flex items-center gap-1 rounded-md p-1",- statusIconMap[status].bgColor,+ style.bgColor,)}>- {statusIconMap[status].icon}+ {style.icon}<Textvariant="small-medium"- className={cn(statusIconMap[status].textColor, "capitalize")}+ className={cn(style.textColor, "capitalize")}>- {getRunStatusInfo(status).label}+ {label}</Text></div>);diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/sidebar/SidebarRunsList/components/TaskListItem.tsx b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/sidebar/SidebarRunsList/components/TaskListItem.tsxindex 3d59e80b5d..8250bf20c7 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/sidebar/SidebarRunsList/components/TaskListItem.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/sidebar/SidebarRunsList/components/TaskListItem.tsx@@ -5,10 +5,16 @@ import { GraphExecutionMeta } from "@/app/api/__generated__/models/graphExecutioimport { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";import { formatDistanceToNow } from "date-fns";import React from "react";+import {+ describeFailedSteps,+ getFailedStepCount,+ isCompletedWithErrors,+} from "@/lib/run-health";import { IconWrapper } from "./IconWrapper";import { SidebarItemCard } from "./SidebarItemCard";import { TaskActionsDropdown } from "./TaskActionsDropdown";import {+ Alert02Icon,AlertCircleIcon,CancelCircleIcon,CheckmarkCircle02Icon,@@ -66,6 +72,12 @@ interface Props {onDeleted?: () => void;}+const completedWithErrorsIcon = (+ <IconWrapper className="border-amber-50 bg-amber-50">+ <Icon icon={Alert02Icon} size={16} className="text-amber-700" />+ </IconWrapper>+);+export function TaskListItem({run,title,@@ -74,22 +86,28 @@ export function TaskListItem({onClick,onDeleted,}: Props) {+ const withErrors = isCompletedWithErrors(run);const icon = run.is_dry_run ? (<IconWrapper className="border-amber-50 bg-amber-50"><Icon icon={FlaskConicalIcon} size={16} className="text-amber-700" /></IconWrapper>+ ) : withErrors ? (+ completedWithErrorsIcon) : (statusIconMap[run.status]);+ const startedAgo = run.started_at+ ? formatDistanceToNow(run.started_at, { addSuffix: true })+ : "—";return (<SidebarItemCardicon={icon}title={run.is_dry_run ? `${title} (Simulated)` : title}description={- run.started_at- ? formatDistanceToNow(run.started_at, { addSuffix: true })- : "—"+ withErrors+ ? `${describeFailedSteps(getFailedStepCount(run))} · ${startedAgo}`+ : startedAgo}descriptionTitle={run.started_at ? new Date(run.started_at).toString() : undefineddiff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/AgentBriefingPanel/components/BriefingTabContent/__tests__/sections.test.tsx b/autogpt_platform/frontend/src/app/(platform)/library/components/AgentBriefingPanel/components/BriefingTabContent/__tests__/sections.test.tsxindex d3991ec614..6f00f1de76 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/components/AgentBriefingPanel/components/BriefingTabContent/__tests__/sections.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/AgentBriefingPanel/components/BriefingTabContent/__tests__/sections.test.tsx@@ -74,8 +74,44 @@ describe("ExecutionListSection", () => {expect(screen.getAllByText("Crunching data").length).toBe(7);expect(screen.getByRole("button", { name: /collapse/i })).toBeDefined();});++ it("flags a recently completed run whose step failed instead of calling it a success", async () => {+ const agents = [+ makeAgent({ id: "lib-1", graph_id: "g-1", name: "Newsletter" }),+ makeAgent({ id: "lib-2", graph_id: "g-2", name: "Digest" }),+ ];+ server.use(+ getGetV1ListAllExecutionsMockHandler200([+ makeCompletedExecution("g-1", "exec-1", 1),+ makeCompletedExecution("g-2", "exec-2", 0),+ ]),+ );++ render(<ExecutionListSection activeTab="completed" agents={agents} />);++ expect(+ await screen.findByText("Completed with errors: 1 step failed"),+ ).toBeDefined();+ expect(screen.getAllByText("Completed successfully").length).toBe(1);+ });});+function makeCompletedExecution(+ graphID: string,+ id: string,+ nodeErrorCount: number,+): GraphExecutionMeta {+ return {+ id,+ graph_id: graphID,+ graph_version: 1,+ status: "COMPLETED",+ started_at: new Date().toISOString(),+ ended_at: new Date().toISOString(),+ stats: { node_error_count: nodeErrorCount },+ } as unknown as GraphExecutionMeta;+}+describe("AgentListSection", () => {it("lists listening agents with their status label and toggles 'Show all'", async () => {const agents = Array.from({ length: 7 }, (_, i) =>diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/AgentBriefingPanel/components/BriefingTabContent/components/ExecutionListSection.tsx b/autogpt_platform/frontend/src/app/(platform)/library/components/AgentBriefingPanel/components/BriefingTabContent/components/ExecutionListSection.tsxindex bab195f21e..8bc9636867 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/components/AgentBriefingPanel/components/BriefingTabContent/components/ExecutionListSection.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/AgentBriefingPanel/components/BriefingTabContent/components/ExecutionListSection.tsx@@ -21,7 +21,9 @@ export function ExecutionListSection({ activeTab, agents }: Props) {const filtered = allItems.filter((item) => {if (activeTab === "running") return item.priority === "running";if (activeTab === "attention") return item.priority === "error";- if (activeTab === "completed") return item.priority === "success";+ if (activeTab === "completed") {+ return item.priority === "success" || item.priority === "warning";+ }return false;});diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx b/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsxindex a0d7bff4ea..4f1efae95e 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx@@ -10,6 +10,7 @@ import { ContextualActionButton } from "../ContextualActionButton/ContextualActiimport styles from "./SitrepItem.module.css";import { buildAutoPilotPrompt } from "./helpers";import {+ Alert02Icon,AlertCircleIcon,Calendar03Icon,Chatting01Icon,@@ -51,6 +52,11 @@ const PRIORITY_CONFIG: Record<color: "text-yellow-600",bg: "bg-yellow-50",},+ warning: {+ icon: Alert02Icon,+ color: "text-amber-600",+ bg: "bg-amber-50",+ },success: {icon: CheckmarkCircle02Icon,color: "text-green-600",@@ -133,7 +139,7 @@ export function SitrepItem({ item }: Props) {</div><div className="flex flex-shrink-0 flex-wrap items-center justify-center gap-1.5 sm:flex-nowrap sm:justify-end">- {item.priority === "success" ? (+ {item.priority === "success" || item.priority === "warning" ? (<NextLinkhref={`/library/agents/${item.agentID}${item.executionID ? `?activeItem=${item.executionID}` : ""}`}className="inline-flex items-center gap-1 rounded-md px-2 py-1.5 text-[13px] font-medium text-zinc-600 transition-colors hover:bg-zinc-50 hover:text-zinc-800"diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/helpers.tsindex 9270914f87..ccf3215190 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/helpers.ts+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/helpers.ts@@ -12,6 +12,8 @@ export function buildAutoPilotPrompt(item: SitrepItemData): string {return `Give me a status update on the ${item.agentName} run — what has it found so far?${idHint}`;case "stale":return `${item.agentName} hasn't run recently. Should I keep it or update and re-run it?${idHint}`;+ case "warning":+ return `${item.agentName}'s last run finished, but it says "${item.message}". Which step failed, why, and how do I fix it?${idHint}`;case "success":return `Show me what ${item.agentName} found in its last run — summarize the results and any key takeaways.${idHint}`;case "listening":diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/useSitrepItems.ts b/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/useSitrepItems.tsindex 4dd0928dd7..462a95785d 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/useSitrepItems.ts+++ b/autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/useSitrepItems.ts@@ -5,6 +5,11 @@ import { AgentExecutionStatus } from "@/app/api/__generated__/models/agentExecutimport type { GraphExecutionMeta } from "@/app/api/__generated__/models/graphExecutionMeta";import type { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent";import { okData } from "@/app/api/helpers";+import {+ describeFailedSteps,+ getFailedStepCount,+ isCompletedWithErrors,+} from "@/lib/run-health";import { useMemo } from "react";import type { SitrepItemData, SitrepPriority } from "../../types";import {@@ -52,10 +57,11 @@ export function useSitrepItems(error: 0,running: 1,stale: 2,- success: 3,- listening: 4,- scheduled: 5,- idle: 6,+ warning: 3,+ success: 4,+ listening: 5,+ scheduled: 6,+ idle: 7,};items.sort((a, b) => order[a.priority] - order[b.priority]);@@ -128,15 +134,30 @@ function buildSitrepFromExecutions((e) => e.status === AgentExecutionStatus.COMPLETED,);if (lastCompleted) {- const summary =- lastCompleted.stats?.activity_status ?? "Completed successfully";+ const summary = lastCompleted.stats?.activity_status;+ if (isCompletedWithErrors(lastCompleted)) {+ const failedSteps = describeFailedSteps(+ getFailedStepCount(lastCompleted),+ );+ return {+ id: `${agent.id}-${lastCompleted.id}`,+ agentID: agent.id,+ agentName: agent.name,+ executionID: lastCompleted.id,+ priority: "warning",+ message: summary+ ? `${failedSteps} — ${summary}`+ : `Completed with errors: ${failedSteps}`,+ status: "idle",+ };+ }return {id: `${agent.id}-${lastCompleted.id}`,agentID: agent.id,agentName: agent.name,executionID: lastCompleted.id,priority: "success",- message: typeof summary === "string" ? summary : "Completed successfully",+ message: summary ?? "Completed successfully",status: "idle",};}diff --git a/autogpt_platform/frontend/src/app/(platform)/library/types.ts b/autogpt_platform/frontend/src/app/(platform)/library/types.tsindex c19b89077c..d73c26c279 100644--- a/autogpt_platform/frontend/src/app/(platform)/library/types.ts+++ b/autogpt_platform/frontend/src/app/(platform)/library/types.ts@@ -49,6 +49,7 @@ export type SitrepPriority =| "error"| "running"| "stale"+ | "warning"| "success"| "listening"| "scheduled"diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityItem.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityItem.tsxindex ca0b46d1d6..9e3451b8af 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityItem.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/ActivityItem.tsx@@ -3,6 +3,7 @@import { AgentExecutionStatus } from "@/app/api/__generated__/models/agentExecutionStatus";import { LoadingSpinner } from "@/components/atoms/LoadingSpinner/LoadingSpinner";import { Text } from "@/components/atoms/Text/Text";+import { isCompletedWithErrors } from "@/lib/run-health";import { formatTimeAgo } from "@/lib/utils/time";import { cn } from "@/lib/utils";import Link, { useLinkStatus } from "next/link";@@ -10,6 +11,7 @@ import type { AgentExecutionWithInfo } from "../helpers";import { getExecutionDuration } from "../helpers";import {Alert01Icon,+ Alert02Icon,ArrowUpRight01Icon,CheckmarkCircle02Icon,Clock01Icon,@@ -62,7 +64,9 @@ export function ActivityItem({ execution, newLayout = false }: Props) {/>);case AgentExecutionStatus.COMPLETED:- return (+ return isCompletedWithErrors(execution) ? (+ <Icon icon={Alert02Icon} size={18} className="text-amber-600" />+ ) : (<Iconicon={CheckmarkCircle02Icon}size={18}@@ -121,7 +125,9 @@ export function ActivityItem({ execution, newLayout = false }: Props) {let statusText = "ended";switch (execution.status) {case AgentExecutionStatus.COMPLETED:- statusText = "completed";+ statusText = isCompletedWithErrors(execution)+ ? "completed with errors"+ : "completed";break;case AgentExecutionStatus.FAILED:statusText = "failed";diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/__tests__/ActivityItem.test.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/__tests__/ActivityItem.test.tsxindex 21c90fd55d..973f7e43a9 100644--- a/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/__tests__/ActivityItem.test.tsx+++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/AgentActivityDropdown/components/__tests__/ActivityItem.test.tsx@@ -60,6 +60,27 @@ describe("ActivityItem", () => {expect(screen.getByText("Weather Agent")).toBeDefined();});+ it("says a completed run with a failed step completed with errors", () => {+ render(+ <ActivityItem+ execution={makeExecution({ stats: { node_error_count: 1 } })}+ />,+ );++ expect(screen.getByText(/^Completed with errors /)).toBeDefined();+ });++ it("says a clean completed run completed", () => {+ render(+ <ActivityItem+ execution={makeExecution({ stats: { node_error_count: 0 } })}+ />,+ );++ expect(screen.getByText(/^Completed /)).toBeDefined();+ expect(screen.queryByText(/with errors/)).toBeNull();+ });+it("renders a non-linked item when the execution has no library agent", () => {render(<ActivityItemdiff --git a/autogpt_platform/frontend/src/lib/run-health.ts b/autogpt_platform/frontend/src/lib/run-health.tsnew file mode 100644index 0000000000..c851d66d76--- /dev/null+++ b/autogpt_platform/frontend/src/lib/run-health.ts@@ -0,0 +1,22 @@+import { AgentExecutionStatus } from "@/app/api/__generated__/models/agentExecutionStatus";++interface RunWithStats {+ status: string;+ stats?: { node_error_count?: number } | null;+}++// A failed step doesn't fail its run (backend/executor/manager.py), so a run+// can report COMPLETED while one of its steps errored.+export function getFailedStepCount(run: RunWithStats): number {+ return run.stats?.node_error_count ?? 0;+}++export function isCompletedWithErrors(run: RunWithStats): boolean {+ return (+ run.status === AgentExecutionStatus.COMPLETED && getFailedStepCount(run) > 0+ );+}++export function describeFailedSteps(count: number): string {+ return count === 1 ? "1 step failed" : `${count} steps failed`;+}diff --git a/autogpt_platform/frontend/src/playwright/journeys/run-correctness-journey.spec.ts b/autogpt_platform/frontend/src/playwright/journeys/run-correctness-journey.spec.tsindex 7bae0da08a..e3a342da53 100644--- a/autogpt_platform/frontend/src/playwright/journeys/run-correctness-journey.spec.ts+++ b/autogpt_platform/frontend/src/playwright/journeys/run-correctness-journey.spec.ts@@ -91,32 +91,43 @@ test.describe("run correctness journey", () => {.toMatch(TERMINAL_STATUS);});- test("a run whose node fails is marked FAILED and shows the user the error", async ({+ test("a run whose node fails shows the user which step failed and why", async ({page,journeyUser: _user,}, testInfo) => {- // Today a node error with nothing wired to its error output is non-fatal- // (backend/executor/manager.py): the run reports COMPLETED and the run- // view says "No output from this run." with no sign of the error. Whether- // the run should fail is the open product question of #14275 and- // SECRT-2840; either way the user needs to see the error. Remove this- // marker when both hold.- test.fail(- true,- "https://github.com/Significant-Gravitas/AutoGPT/issues/14275",- );+ // A node error with nothing wired to its error output doesn't fail the+ // run (backend/executor/manager.py), so the run reports COMPLETED. Whether+ // it should fail is the open product question of #14275 and SECRT-2840;+ // either way the user must see which step failed and why.const { agent, runID } = await runAgentWithFailingNode(page, testInfo);await expect.poll(() => getRunStatus(page, agent.graphID, runID), {- message: "the run should end as FAILED",+ message: "the run should end as COMPLETED, its node error non-fatal",timeout: 30_000,})- .toBe("FAILED");+ .toBe("COMPLETED");++ const failures = page.getByTestId("run-failures");await expect(- page.getByText(/Invalid regex pattern/).first(),- "the node's error should be shown in the run view",- ).toBeVisible();+ failures,+ "the run view should say that a step failed",+ ).toContainText("1 step failed");+ await expect(+ failures,+ "the run view should name the step that failed",+ ).toContainText("Match Text Pattern");+ await expect(+ failures,+ "the run view should show the step's error",+ ).toContainText(/Invalid regex pattern/);++ await page.goto(agent.url);+ await waitForAgentPageLoad(page);+ await expect(+ runListItem(page, runID),+ "the Library run list should mark the run as having a failed step",+ ).toContainText("1 step failed");});});diff --git a/autogpt_platform/frontend/src/playwright/pages/library.page.ts b/autogpt_platform/frontend/src/playwright/pages/library.page.tsindex a91e033e99..716d9400fb 100644--- a/autogpt_platform/frontend/src/playwright/pages/library.page.ts+++ b/autogpt_platform/frontend/src/playwright/pages/library.page.ts@@ -884,7 +884,13 @@ export async function isLoaded(page: Page): Promise<boolean> {}const SUCCESS_RUN_STATUS = "completed";-const FAILURE_RUN_STATUSES = new Set(["failed", "terminated", "incomplete"]);+// A run whose step failed still ends COMPLETED; its badge says so.+const FAILURE_RUN_STATUSES = new Set([+ "failed",+ "terminated",+ "incomplete",+ "completed with errors",+]);const RUN_ERROR_RECOVERY_GRACE_PERIOD_MS = 1500;const RUN_ERROR_RECOVERY_ATTEMPTS = 2;@@ -1353,6 +1359,7 @@ export async function clickExportAgent(page: Page): Promise<void> {// elsewhere on the page (filter chips, tooltips, etc.).const RUN_STATUS_WORDS = ["completed",+ "completed with errors","failed","terminated","incomplete",