From 96910f0f504ec5f03a8a81d4a742ac63f458f2b7 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Mon, 11 May 2026 16:56:26 +0000 Subject: [PATCH] fix(run-audit): drop summary comment, fall back to agent final message in job summary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the audit agent's final 'post a short summary' instruction was ambiguous and, with no PR/issue context on schedule runs, caused the agent to invent a target — landing the summary as a comment on the most recent open PR (see #650). drop the comment instruction outright. writeJobSummary now falls back to the agent's final assistant message (result.output) when lastProgressBody is empty, so non-PR runs surface a real summary in the GitHub Actions job summary tab instead of just the usage table. lastProgressBody still wins when present to avoid duplicating the progress comment body. --- main.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.ts b/main.ts index 2264cc3..ab2f341 100644 --- a/main.ts +++ b/main.ts @@ -514,9 +514,14 @@ async function persistSummary(ctx: ToolContext): Promise { }); } -async function writeJobSummary(toolState: ToolState): Promise { +// fall back to the agent's final assistant message when the agent never +// called report_progress (e.g. schedule/workflow_dispatch runs that have no +// PR/issue context to comment on). lastProgressBody wins when present so we +// don't double up the progress comment body in the job summary. +async function writeJobSummary(toolState: ToolState, finalOutput?: string): Promise { const usageSummary = formatUsageSummary(toolState.usageEntries); - const summaryParts = [toolState.lastProgressBody, usageSummary].filter(Boolean); + const body = toolState.lastProgressBody || finalOutput; + const summaryParts = [body, usageSummary].filter(Boolean); if (summaryParts.length > 0) { await writeSummary(summaryParts.join("\n\n")); } @@ -1087,7 +1092,7 @@ export async function main(): Promise { // is informational; let it fail silently rather than corrupt user-facing // output. try { - await writeJobSummary(toolState); + await writeJobSummary(toolState, result.output); } catch (error) { log.debug(`job summary write failed: ${error}`); }