feat(task): surface explicit abort reasons for subagent results

- Add a dedicated abortReason field to SingleResult and thread it through task execution paths so aborted subagents show actionable context instead of a generic badge.
- Populate abortReason for signal cancellation, pre-start cancellation, submit_result aborted status, and missing submit_result after reminders

Fixes #248
This commit is contained in:
can1357
2026-03-03 04:14:04 +01:00
parent 801553b118
commit a88dd79f9c
6 changed files with 132 additions and 5 deletions
+6 -1
View File
@@ -783,6 +783,11 @@ function renderAgentResult(result: SingleResult, isLast: boolean, expanded: bool
lines.push(...renderTaskSection(result.task, continuePrefix, expanded, theme));
if (aborted && result.abortReason) {
lines.push(
`${continuePrefix}${theme.fg("error", theme.status.aborted)} ${theme.fg("dim", truncateToWidth(replaceTabs(result.abortReason), 80))}`,
);
}
// Check for review result (submit_result with review schema + report_finding)
const completeData = result.extractedToolData?.submit_result as Array<{ data: unknown }> | undefined;
const reportFindingData = normalizeReportFindings(result.extractedToolData?.report_finding);
@@ -873,7 +878,7 @@ function renderAgentResult(result: SingleResult, isLast: boolean, expanded: bool
}
// Error message
if (result.error && (!success || mergeFailed)) {
if (result.error && (!success || mergeFailed) && (!aborted || result.error !== result.abortReason)) {
lines.push(`${continuePrefix}${theme.fg(mergeFailed ? "warning" : "error", truncateToWidth(result.error, 70))}`);
}