diff --git a/entry b/entry index 7dee765..770f4ed 100755 --- a/entry +++ b/entry @@ -147426,6 +147426,16 @@ function CreatePullRequestReviewTool(ctx) { parameters: CreatePullRequestReview, execute: execute(async ({ pull_number, body, approved, commit_id, comments = [] }) => { if (body) body = fixDoubleEscapedString(body); + if (body && ctx.toolState.selectedMode === "Review" && ctx.toolState.todoTracker) { + ctx.toolState.todoTracker.cancel(); + await ctx.toolState.todoTracker.settled(); + const collapsible = ctx.toolState.todoTracker.renderCollapsible(); + if (collapsible) { + body = `${body} + +${collapsible}`; + } + } ctx.toolState.issueNumber = pull_number; if (!approved && !body && comments.length === 0) { log.info( @@ -151495,6 +151505,11 @@ ${instructions.user}` : null, log.debug(`post-review cleanup failed: ${error49}`); }); } + if (toolContext && toolState.review && toolState.progressCommentId) { + await deleteProgressComment(toolContext).catch((error49) => { + log.debug(`review progress comment cleanup failed: ${error49}`); + }); + } const trackerWasLastWriter = todoTracker?.hasPublished && !toolState.finalSummaryWritten; if (toolContext && toolState.progressCommentId && (!toolState.wasUpdated || trackerWasLastWriter)) { await deleteProgressComment(toolContext).catch((error49) => { diff --git a/main.ts b/main.ts index c5c7485..ede1253 100644 --- a/main.ts +++ b/main.ts @@ -407,6 +407,17 @@ export async function main(): Promise { }); } + // review submitted → always delete the progress comment. + // the review is the durable artifact; the progress comment is noise. + // defense-in-depth: covers the case where the agent calls report_progress + // despite mode instructions, which sets finalSummaryWritten and prevents + // the stranded-comment heuristic below from firing. + if (toolContext && toolState.review && toolState.progressCommentId) { + await deleteProgressComment(toolContext).catch((error) => { + log.debug(`review progress comment cleanup failed: ${error}`); + }); + } + // clean up stranded progress comments. two cases: // 1. wasUpdated=false: nothing wrote to the comment ("Leaping into action" orphan) // 2. tracker published a checklist but the agent never wrote a final summary diff --git a/mcp/review.ts b/mcp/review.ts index 030aab9..5a35cc1 100644 --- a/mcp/review.ts +++ b/mcp/review.ts @@ -83,6 +83,16 @@ export function CreatePullRequestReviewTool(ctx: ToolContext) { execute: execute(async ({ pull_number, body, approved, commit_id, comments = [] }) => { if (body) body = fixDoubleEscapedString(body); + // in Review mode (not IncrementalReview), append the completed task list + if (body && ctx.toolState.selectedMode === "Review" && ctx.toolState.todoTracker) { + ctx.toolState.todoTracker.cancel(); + await ctx.toolState.todoTracker.settled(); + const collapsible = ctx.toolState.todoTracker.renderCollapsible(); + if (collapsible) { + body = `${body}\n\n${collapsible}`; + } + } + // set issue context (PRs are issues) ctx.toolState.issueNumber = pull_number;