Skip to content

Reviews feature enhancements: suppress stale review delivery for older PR heads #407

Description

@neversettle17-101

Summary

Track follow-up reviews feature enhancements around stale review delivery and batch hardening.

The new multi-PR batch delivery path should suppress changes_requested results for older PR heads by checking (pr_url, target_sha) against the current PR head before notifying the worker. This issue tracks keeping that invariant explicit across all review delivery paths and future review enhancements.

Problem

Example flow:

  1. Trigger review creates a review run for PR chore: scaffold backend/ and frontend/ skeletons for rewrite #1 at sha-old.
  2. Reviewer is still working.
  3. Worker pushes sha-new.
  4. Trigger review creates a newer run/batch for PR chore: scaffold backend/ and frontend/ skeletons for rewrite #1 at sha-new.
  5. The old reviewer later submits changes_requested for sha-old.

AO should not notify the worker to address stale feedback for the old SHA.

Desired Behavior

Before sending any worker notification for review feedback:

  • Load the current PR state for each candidate changes_requested run.
  • Deliver only runs whose (pr_url, target_sha) still match the current PR head.
  • Suppress stale runs from worker notification.
  • Keep stale runs in history, but do not send them as actionable feedback.

This should remain true for batch delivery and any legacy/single-run delivery path that can still handle empty batch_id rows.

Acceptance Criteria

  • A changes_requested review for the current PR head sends a worker notification.
  • A changes_requested review for an older SHA does not send a worker notification.
  • Mixed batches deliver only current-head changes_requested runs.
  • Stale suppressed runs do not block the batch forever.
  • Tests cover old-SHA submit after a newer trigger/run exists.

Related Context

This came out of the multi-PR review batching design for issue #395. It is one item in a broader reviews feature enhancements bucket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions