Repository navigation
Description
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
PullRequestWatchReactorscans periodically and dispatches a wake only whenevaluatePullRequestWatchreturns a change. Periodic full reads do not produce a wake for an unchanged, still-running review.evaluatePullRequestWatchhas a missing-checks deadline, but no deadline for an unanswered review or a quiet active wait.scripts/lastcode-pr-gates.tscomputesreview.pendingwithout an age limit, then returnsreview-pendingindefinitely 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
- Finish CI on an open PR.
- Request external review and observe the review-start indication.
- Arm the PR watch and let the agent end its turn.
- Leave the review unchanged without a terminal result or any further GitHub activity.
- 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.
Activity
fix(lastcode): end PR watch waits at a configurable quiet deadline