Skip to content

PR watches can wait indefinitely for reviews that never finish #538

Closed

Description

@lastobelus

A PR watch can remain active indefinitely when the external reviewer starts but never publishes a terminal result. The agent has ended its turn and receives no new event, so the stalled review can silently block the original task for hours.

A watch being active does not establish that the work it is meant to unblock is progressing.

Source findings

  • PullRequestWatchReactor scans periodically and dispatches a wake only when evaluatePullRequestWatch returns a change. Periodic full reads do not produce a wake for an unchanged, still-running review.
  • evaluatePullRequestWatch has a missing-checks deadline, but no deadline for an unanswered review or a quiet active wait.
  • scripts/lastcode-pr-gates.ts computes review.pending without an age limit, then returns review-pending indefinitely when no terminal artifact arrives.
  • The babysit guidance explicitly acknowledges that there is no review timeout. It says to handle a review still missing on a later snapshot, but the native watch has no event that ensures that later snapshot happens.

Relevant code: apps/server/src/orchestration-v2/PullRequestWatchReactor.ts, apps/server/src/orchestration-v2/pullRequestWatch.ts, and scripts/lastcode-pr-gates.ts.

Reproduction

  1. Finish CI on an open PR.
  2. Request external review and observe the review-start indication.
  3. Arm the PR watch and let the agent end its turn.
  4. Leave the review unchanged without a terminal result or any further GitHub activity.
  5. Observe that the watch remains active while the task has no bounded recovery or escalation wake.

Proposed correction

Allow active CI/review work to register a durable quiet-wait deadline, initially one hour. Wake the owning thread once when that deadline expires, even if the host fingerprint is unchanged. Include the wait reason and last successful observation so the agent can decide whether to retry or report a blocker. Persist the deadline and its delivery identity across server restarts, respect environment pauses, and avoid repeated model turns for the same stale wait. Long-term passive monitoring should not acquire this deadline implicitly.

The deadline must not approve a review, waive a merge gate, or merge anything. Keep that decision in the owning agent and the existing approval rules.

Focused regression coverage should demonstrate one wake for an unchanged PR after the deadline, no duplicate wake across sweeps or restarts, reset after relevant progress, and correct pause/resume behavior.

This is a source and retained-history diagnosis. It does not identify why the external review service stopped, and no product fix is included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions