Skip to content

fix: reply to and resolve rejected review threads (and prevent reply loop) - #163

Open
cwbcheng wants to merge 2 commits into
jeremymcs:mainfrom
cwbcheng:pr/rejected-threads
Open

fix: reply to and resolve rejected review threads (and prevent reply loop)#163
cwbcheng wants to merge 2 commits into
jeremymcs:mainfrom
cwbcheng:pr/rejected-threads

Conversation

@cwbcheng

@cwbcheng cwbcheng commented Aug 5, 2026

Copy link
Copy Markdown

Problem

Two related bugs in the review-thread lifecycle:

  1. Rejected review threads are silently dropped. needsGitHubFollowUp() returns false for any item whose decision !== "accept", so a review comment that the agent evaluates as reject is never replied to and its conversation is never resolved on GitHub. This contradicts the code-owner agent prompt, which explicitly says: "For rejected feedback: Reply directly to the GitHub comment/thread with what was done, or why it was rejected. Resolve the GitHub conversation after replying." The thread stays open forever with no feedback.

  2. PatchDeck replies to its own audit-trail comments, looping forever. Once rejected threads started getting follow-up replies, the exclusion for PatchDeck's own comments only matched "PatchDeck status comment" and "Automation audit trail follow-up", missing "PatchDeck audit trail comment" and "PatchDeck agent command comment". A rejected reply that PatchDeck itself posted was treated as real reviewer feedback, producing another follow-up reply, which produced another audit trail, which was replied to again — an infinite loop (we observed ~5 duplicate replies stacking on a single thread).

Changes

  • server/babysitter.ts
    • needsGitHubFollowUp() now includes rejected review-thread items (excluding PatchDeck's own status/audit-trail/agent-command replies), so they get a closing reply + conversation resolution.
    • collectAuditTrailErrors() skips the code-change audit requirement for rejected review threads (there is no code change to audit); only thread resolution is verified.
    • The follow-up body for rejected items says the change was rejected with the reason (Rejected — no code change made. **Reason:** …), and the item keeps its rejected status while the thread-resolved flag advances.
    • The internal-reply exclusion now matches all four PatchDeck-authored marker reasons.
  • server/github.ts — no change (exclusion lives in babysitter).

Tests

  • New: babysitPR replies to and resolves rejected review threads — a rejected review thread triggers a follow-up with resolve: true and the thread is resolved.
  • New: babysitPR does not re-reply to its own rejected audit-trail comments — a rejected item whose statusReason is PatchDeck audit trail comment never triggers a follow-up (regression guard for the loop).
  • Updated existing tests whose expectations changed because rejected review threads are now followed up.

Environment

  • Node.js 22, WSL2, codex CLI 0.146.0 (DeepSeek-backed provider)

Rejected review-thread feedback previously fell through the GitHub
follow-up path silently: needsGitHubFollowUp only considered accepted
items, so a rejected review comment was never replied to and its
conversation was never resolved, contradicting the agent prompt that
says to reply with the rejection reason and resolve the conversation.

Now rejected review threads (excluding PatchDeck's own status/audit-trail
replies) are collected as follow-up tasks, get a 'Rejected - no code
change made' reply with the reason, and the conversation is resolved.
Audit-trail verification skips the code-change audit for these items and
only requires thread resolution, and the final status update keeps the
rejection decision while advancing the thread-resolved flag.
The internal-reply exclusion in needsGitHubFollowUp only matched
'PatchDeck status comment' and 'Automation audit trail follow-up', but
classifyNonActionableAppFeedback also produces 'PatchDeck audit trail
comment' and 'PatchDeck agent command comment'. A rejected item carrying
one of those reasons was treated as real reviewer feedback, which made
PatchDeck reply to its own follow-up comment, producing a new audit
trail, which was then replied to again - an infinite loop.

Widen the exclusion to all PatchDeck-authored marker reasons and add a
regression test that a rejected audit-trail comment never triggers a
follow-up reply.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant