fix(run-audit): drop summary comment, fall back to agent final message in job summary

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.
This commit is contained in:
Colin McDonnell
2026-05-11 16:56:26 +00:00
committed by pullfrog[bot]
parent 4cc6d95a91
commit 96910f0f50
+8 -3
View File
@@ -514,9 +514,14 @@ async function persistSummary(ctx: ToolContext): Promise<void> {
});
}
async function writeJobSummary(toolState: ToolState): Promise<void> {
// 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<void> {
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<MainResult> {
// 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}`);
}