review: append todo list to review body, always delete progress comment

- in Review mode, stop the todo tracker and append the completed task
  list as a collapsible section to the review body before submitting
- always delete the progress comment after a review is submitted,
  regardless of whether the agent called report_progress

Made-with: Cursor
This commit is contained in:
Colin McDonnell
2026-04-04 21:59:29 +00:00
committed by pullfrog[bot]
parent 8f7145e716
commit 426ef8c0d8
3 changed files with 36 additions and 0 deletions
+15
View File
@@ -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) => {
+11
View File
@@ -407,6 +407,17 @@ export async function main(): Promise<MainResult> {
});
}
// 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
+10
View File
@@ -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;