Skip to content

pr_review.py wait Reports a Spent Quota Refusal as Exit 46 When a Later Round on the Same Head States No Coverage #2820

Closed

Description

@ptr727

Evidence

scripts/pr_review.py wait exits 46 (COPILOT_QUOTA_EXHAUSTED, "the newest Copilot review declined") on a pull request whose newest Copilot review is a genuine round, not a refusal.

Constructed shape that triggers it. All rounds sit on the same head H:

  1. Copilot round 1 on H: the body is the account-quota refusal ("Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.").
  2. The quota is restored, then wait <n> --request --ignore-quota-signal --min-rounds 2.
  3. Copilot round 2 on H is a genuine ccr-overview-v2 round, "Approval recommended", 0 open findings, with no file table and no coverage statement.

Observed: the digest line reads rounds=2 review_on_head=yes refusal=no coverage=unstated, then status=COPILOT_QUOTA_EXHAUSTED ... and exit 46. status on the same head exits 45 (COVERAGE_IS_UNSTATED), which is the accurate reading.

Expected: wait reports the same state status does, coverage unstated (exit 45). The refusal on H is spent by the later genuine round on H.

Cause

refusing_review() returns the newest refusal on the head without checking for a later genuine round on that head. Its docstring says the caller handles that case, since "main returns 0 on reviewed_head before reaching here". That holds only when the reviewed head is also complete. A genuine round with unstated coverage does not return 0, so wait falls through to the refusal and quota_refusal(refusal) branch and reports exit 46 from the spent refusal. The --ignore-quota-signal flag guards only stopping_refusal, not this path.

Impact

Exit 46 tells the driver that an account-level state blocks the round and that nothing the loop does clears it. That sends the pull request to the maintainer as a quota problem when the quota was already restored and the actual gap is coverage. It also contradicts the digest's own refusal=no field.

Fix

Have refusing_review() (or the wait branch that calls it) treat a refusal as spent where a later non-refusal Copilot round exists on the same head. Add a test with the two-round shape above.

Activity

  1. added
    script
    on Oct 11, 2026
  2. added a commit that references this issue on Oct 11, 2026
    fdb8c30
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

    script

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions