From 70689ce32605fbcae4aaa286575f9427fa2d7fd0 Mon Sep 17 00:00:00 2001 From: anvyle Date: Thu, 9 Apr 2026 22:40:39 +0200 Subject: [PATCH] fix(frontend/copilot): guard isPending flag on error and filter empty steps from approval - Prevent simultaneous pending + error state when output-error has null payload: isPending is now false when isError is true - Filter out steps with empty descriptions before building the approval message, preventing malformed input from reaching the LLM Co-Authored-By: Claude Sonnet 4.6 --- .../copilot/tools/DecomposeGoal/DecomposeGoal.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx index 41f348e974..d55304a4ce 100644 --- a/autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/copilot/tools/DecomposeGoal/DecomposeGoal.tsx @@ -56,7 +56,7 @@ export function DecomposeGoalTool({ part, isLastMessage }: Props) { const output = getDecomposeGoalOutput(part); const isError = part.state === "output-error" || (!!output && isErrorOutput(output)); - const isPending = !output; + const isPending = !output && !isError; const showActions = !!isLastMessage && @@ -80,7 +80,10 @@ export function DecomposeGoalTool({ part, isLastMessage }: Props) { function buildMessage() { if (isEditingRef.current && editableStepsRef.current.length > 0) { - const list = editableStepsRef.current + const filledSteps = editableStepsRef.current.filter((s) => + s.description.trim(), + ); + const list = filledSteps .map((s, i) => `${i + 1}. ${s.description}`) .join("; "); return `Approved with modifications. Please build the agent following these steps: ${list}`;