* Build report_incomplete context string for display in failure issues/comments. * This surfaces the agent's structured incompletion signal so maintainers can * distinguish a tool-failure report from a real task outcome. * @param {Array } [items] - Optional pre-loaded agent output items. When
(items)
| 1520 | * @returns {string} Formatted report_incomplete context |
| 1521 | */ |
| 1522 | function buildReportIncompleteContext(items) { |
| 1523 | const messages = loadReportIncompleteMessages(items); |
| 1524 | |
| 1525 | if (messages.length === 0) { |
| 1526 | return ""; |
| 1527 | } |
| 1528 | |
| 1529 | core.info(`Found ${messages.length} report_incomplete signal(s)`); |
| 1530 | |
| 1531 | let context = buildWarningAlertLine("Task Could Not Be Completed", "The agent reported that the task could not be performed due to an infrastructure or tool failure.") + "\n**Reasons:**\n"; |
| 1532 | for (const msg of messages) { |
| 1533 | context += `- ${msg.reason}\n`; |
| 1534 | if (msg.details) { |
| 1535 | context += ` \n ${msg.details}\n`; |
| 1536 | } |
| 1537 | } |
| 1538 | context += |
| 1539 | "\nThis is a structured incompletion signal (`report_incomplete`), not a real task outcome. Any other safe outputs emitted alongside this signal (e.g., comments) describe the failure state, not a completed review or action.\n\n"; |
| 1540 | |
| 1541 | return context; |
| 1542 | } |
| 1543 | |
| 1544 | /** |
| 1545 | * Build a context string with a frontmatter hint when the agent timed out. |
no test coverage detected