fix(copilot): fall back to default approval when all step descriptions are empty

If the user cleared all step descriptions without deleting the steps,
buildMessage() produced "Approved with modifications. Please build the
agent following these steps: " — a dangling colon with no actual steps.
Now falls back to the standard "Approved. Please build the agent." when
filledSteps is empty after filtering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
anvyle
2026-04-14 22:36:41 +02:00
parent 0840b565e3
commit d892b66580

View File

@@ -133,10 +133,12 @@ export function DecomposeGoalTool({
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}`;
if (filledSteps.length > 0) {
const list = filledSteps
.map((s, i) => `${i + 1}. ${s.description}`)
.join("; ");
return `Approved with modifications. Please build the agent following these steps: ${list}`;
}
}
return "Approved. Please build the agent.";
}