fix(pr-reviewer): gate the "ready" ping; stop committing VFS state

Merged
KH
6mo ago
+206-14

Why

From the review channel: the pr-reviewer was sending duplicate "ready for your review" reminders, pinging PRs that were already merged, and saying ready while checks were still pending. It was also committing a relay VFS state file into every PR.

Changes (review/agent.ts)

  • Don't announce a merged/closed PR as ready. verifyReadyForHumanReview now queries state,mergeable,mergeStateStatus,reviewDecision,statusCheckRollup (was just mergeable,statusCheckRollup) and prReadyStateAllowsHumanReview rejects anything not OPEN.
  • Don't announce ready with pending checks. An empty statusCheckRollup used to pass vacuously ([].every() === true) — exactly the window where checks are queued but not yet registered. Now empty → not ready. Drafts and CHANGES_REQUESTED are also held back. So a ping requires: open, no conflicts, not draft, no changes-requested, ≥1 check, all checks complete + passing.
  • No duplicate reminders for the same commit. announceReadyOnce records the head SHA it announced ready for (workspace memory) and won't re-announce it on subsequent webhooks; a genuinely new head SHA still gets a note, threaded under the PR's first Slack message via the existing postSlackPrUpdate threading.
  • Reply to bot/reviewer comments with where they were fixed. The harness prompt now requires an ## Addressed comments section — one bullet per comment with the file:line of the fix (or a reason if skipped). The sandbox has no gh/git and the VFS client only exposes whole-PR comment/review, so this lands in the posted PR comment. Per-thread in-thread replies are tracked in AgentWorkforce/relayfile-adapters#160.

Also

  • Stop committing memory/workspace/.relay/state.json — relay VFS runtime state rewritten every reconcile cycle, which the review harness kept committing to PRs. git rm --cached + gitignored.

Tests

npm run test + npm run typecheck green. Added cases for merged/closed, empty rollup, draft, changes-requested, and the addressed-comments prompt requirement.

Related issues

🤖 Generated with Claude Code


Summary by cubic

Fixes noisy “ready for review” pings by gating on PR state and CI, deduping once per head commit with a race-safe reservation, and ignoring Relay VFS state. Adds an “Addressed comments” section with exact file:line locations.

  • Bug Fixes

    • Announce ready only when the PR is open, mergeable, not draft, and has no changes requested. Checks must be complete and passing; SKIPPED is non-blocking. An empty rollup is ready only when GitHub reports CLEAN (no-CI repos), otherwise it stays pending.
    • Send the ready message once per head SHA; populate missing SHAs via gh pr view --json headRefOid. Use a workspace reservation to choose a single winner across overlapping runs and mark failures/cancellations so a later retry can post.
    • Stop tracking memory/workspace/.relay/state.json and ignore .relay/ and memory/workspace/.relay/ in .gitignore.
  • New Features

    • The review harness now requires an “## Addressed comments” section with one bullet per comment and the exact file:line of the fix, or a brief reason if skipped.