|
38 | 38 | # base head headOid |
39 | 39 | # checks checks_settled threads unresolved_threads |
40 | 40 | # reviewDecision reviews_on_head has_review_on_head |
41 | | -# has_copilot_review_on_head copilot_review_errored copilot_error_count |
| 41 | +# has_copilot_review_on_head copilot_review_errored copilot_error_count copilot_quota_hit |
42 | 42 | # requested_reviewers |
43 | 43 | # merge_methods auto_merge_allowed queue_active queue_entry |
44 | 44 | # rulesets rules_fetched required_contexts undispatched unsigned |
@@ -308,6 +308,10 @@ evaluate() { |
308 | 308 | # $copilot_errored for why the check-run is not consulted. |
309 | 309 | copilot_review_errored: $copilot_review_errored, |
310 | 310 | copilot_error_count: ($copilot_errored|length), |
| 311 | + # True when an errored Copilot review body names the quota limit. |
| 312 | + # Quota is MONTHLY: once this is true, no re-request on any PR will |
| 313 | + # succeed until the monthly reset — distinct from a transient outage. |
| 314 | + copilot_quota_hit: (([$copilot_errored[] | select((.body // "") | test("quota"; "i"))] | length) > 0), |
311 | 315 | author: $author, |
312 | 316 | requested_reviewers: [$p.reviewRequests.nodes[]?.requestedReviewer|(.login // .slug)], |
313 | 317 | unresolved_threads: ($unresolved|length), |
@@ -422,7 +426,20 @@ evaluate() { |
422 | 426 | elif ($needs_copilot and $s.copilot_review_errored |
423 | 427 | and ($s.has_copilot_review_on_head | not) |
424 | 428 | and (($s.requested_reviewers|map(test("copilot";"i"))|any) | not)) then |
425 | | - (if $copilot_exhausted then |
| 429 | + (if $s.copilot_quota_hit then |
| 430 | + # Quota, not outage: the error body names the quota limit. Said |
| 431 | + # once, with the fact that makes retrying pointless — the quota |
| 432 | + # is monthly and will NOT recover this month, on this or any |
| 433 | + # other PR. No cmd on purpose: there is nothing to run. |
| 434 | + {action:"request-review", |
| 435 | + why:($unreviewed |
| 436 | + + "Copilot is OUT OF REVIEW QUOTA — the error body says the requesting" |
| 437 | + + " user reached the quota limit. The quota is MONTHLY: it will not" |
| 438 | + + " recover this month, on this or any other PR, and re-requesting" |
| 439 | + + " cannot change that. Review the diff yourself, note in the PR that" |
| 440 | + + " the bot review was unavailable, and decide on that. Treat this" |
| 441 | + + " notice as covering every PR until the monthly reset\($stale_approval)")} |
| 442 | + elif $copilot_exhausted then |
426 | 443 | {action:"request-review", |
427 | 444 | why:($unreviewed |
428 | 445 | + "Copilot failed \($s.copilot_error_count)x on \($s.headOid[0:8]), so the COMMENTED rows" |
@@ -631,7 +648,13 @@ while :; do |
631 | 648 | # re-arm of --watch returns instantly with the same line. Saying so is |
632 | 649 | # what stops an operator re-arming it three times before switching to |
633 | 650 | # `gh pr checks --watch`, which watches something that does move. |
634 | | - if [ "$(jq -r '.copilot_error_count // 0' <<<"$s")" -ge 2 ]; then |
| 651 | + if [ "$(jq -r '.copilot_quota_hit // false' <<<"$s")" = "true" ]; then |
| 652 | + echo "ACTIONABLE: request-review (UNSATISFIABLE — Copilot is OUT OF REVIEW QUOTA" \ |
| 653 | + "for the month; this will NOT change until the monthly reset, on this or any" \ |
| 654 | + "other PR. Do not re-arm this watch and do not re-request — review the diff" \ |
| 655 | + "yourself and decide. To watch something that moves:" \ |
| 656 | + "gh pr checks $(jq -r '.number' <<<"$s") --repo $(jq -r '.repo' <<<"$s") --watch)" |
| 657 | + elif [ "$(jq -r '.copilot_error_count // 0' <<<"$s")" -ge 2 ]; then |
635 | 658 | echo "ACTIONABLE: request-review (UNSATISFIABLE — the review bot has failed" \ |
636 | 659 | "$(jq -r '.copilot_error_count' <<<"$s")x on this head; re-arming this watch" \ |
637 | 660 | "returns immediately. Review the diff yourself, or watch the checks instead:" \ |
|
0 commit comments