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 <noreply@anthropic.com>
This commit is contained in:
anvyle
2026-04-09 22:40:39 +02:00
parent 9004a3ada1
commit 70689ce326

View File

@@ -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}`;