fix: include error details in subagent findings [AI-assisted]
When a sub-agent fails (error, timeout, or unknown status), the main agent now receives contextual information about what went wrong instead of just "(no output)". Before: "Findings: (no output)" After: "Findings: Error encountered:\n<error message>" or: "Findings: Task timed out before producing output." or: "Findings: Task ended with unknown status." This helps users understand why a background task failed without needing to inspect raw transcripts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
109ac1c549
commit
6d61961b96
@ -384,12 +384,24 @@ export async function runSubagentAnnounceFlow(params: {
|
|||||||
: "finished with unknown status";
|
: "finished with unknown status";
|
||||||
|
|
||||||
// Build instructional message for main agent
|
// Build instructional message for main agent
|
||||||
|
// Include error context in findings when no reply available
|
||||||
|
let findings = reply;
|
||||||
|
if (!findings) {
|
||||||
|
if (outcome?.status === "error" && outcome?.error) {
|
||||||
|
findings = `Error encountered:\n${outcome.error}`;
|
||||||
|
} else if (outcome?.status === "timeout") {
|
||||||
|
findings = `Task timed out before producing output.`;
|
||||||
|
} else if (outcome?.status === "unknown") {
|
||||||
|
findings = `Task ended with unknown status.`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const taskLabel = params.label || params.task || "background task";
|
const taskLabel = params.label || params.task || "background task";
|
||||||
const triggerMessage = [
|
const triggerMessage = [
|
||||||
`A background task "${taskLabel}" just ${statusLabel}.`,
|
`A background task "${taskLabel}" just ${statusLabel}.`,
|
||||||
"",
|
"",
|
||||||
"Findings:",
|
"Findings:",
|
||||||
reply || "(no output)",
|
findings || "(no output)",
|
||||||
"",
|
"",
|
||||||
statsLine,
|
statsLine,
|
||||||
"",
|
"",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user