Commit b37e435
fix: scope the review-run check to its own PR, and survive a transient 503 (#639)
Two failures in `request-pr-review.sh`, both observed live, both of which cost
a paid review round.
WRONG RUN. `review_run_state()` took the newest `PR Review` run created after
the trigger, with no filter for which PR it belonged to. `pr-review.yml`
triggers on `issue_comment`, which fires for comments on ISSUES too, and those
runs are gated out and complete as `skipped` in about ten seconds. So any
comment posted anywhere in the repo during a review produced a newer run that
was `completed` and not `success` -- read as `failed`.
Measured on #636: a routine PO comment on issue #441 at 21:13:07 made the
script abandon the review, which went on to APPROVE at 21:15:45. The caller was
told the run was broken while it was still thinking, and the natural response
-- re-request -- would have spent a second review round on a review already in
flight.
`displayTitle` carries the PR title for a run triggered on that PR, so it is
the discriminator. The title is read once before the loop and matched via
`--arg`, not string interpolation: a title containing a quote would otherwise
break the filter silently.
TRANSIENT FAILURE. `set -e` turned a single 503 on the verdict read into a
fatal exit 1 -- AFTER the trigger comment had posted, so a re-run again spent a
second round on a live review. GitHub returned 503s for roughly ninety minutes
on 2026-08-17 and this fired twice. Both review reads now tolerate a failed
call and retry on the next poll, which is what `review_run_state` already did
via its `unknown` state.
Both bug tests were verified to fail against the pre-fix script -- the second
reproducing the exact exit 1 with the 503 on stderr -- while
`test_this_prs_own_failed_run_is_still_reported` passes both before and after,
which is what proves the scoping does not swallow a genuine failure.
No CHANGELOG entry: agent tooling, no user-visible effect.
Claude-Session: https://claude.ai/code/session_012LExo6fcbup75vtc9NfoAR
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 8043155 commit b37e435
2 files changed
Lines changed: 159 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| |||
78 | 87 | | |
79 | 88 | | |
80 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
81 | 93 | | |
82 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
83 | 101 | | |
84 | 102 | | |
85 | 103 | | |
86 | 104 | | |
87 | 105 | | |
88 | 106 | | |
| 107 | + | |
89 | 108 | | |
90 | 109 | | |
91 | 110 | | |
| |||
99 | 118 | | |
100 | 119 | | |
101 | 120 | | |
| 121 | + | |
102 | 122 | | |
103 | 123 | | |
104 | 124 | | |
| |||
286 | 306 | | |
287 | 307 | | |
288 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
90 | 106 | | |
91 | 107 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
98 | 117 | | |
99 | 118 | | |
100 | 119 | | |
101 | 120 | | |
102 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
103 | 132 | | |
104 | 133 | | |
105 | 134 | | |
| |||
118 | 147 | | |
119 | 148 | | |
120 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
121 | 157 | | |
122 | 158 | | |
123 | 159 | | |
124 | 160 | | |
125 | 161 | | |
126 | | - | |
| 162 | + | |
127 | 163 | | |
128 | 164 | | |
129 | 165 | | |
| |||
142 | 178 | | |
143 | 179 | | |
144 | 180 | | |
| 181 | + | |
145 | 182 | | |
146 | 183 | | |
147 | 184 | | |
148 | 185 | | |
149 | 186 | | |
150 | | - | |
| 187 | + | |
151 | 188 | | |
152 | 189 | | |
153 | 190 | | |
| |||
0 commit comments