Repository navigation
Conversation
✅ Integration test reportCommit: b034dad
Top 3 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at b034dad. Each finding was verified against the code.
No blocking issues found. 3 non-blocking comment(s) and 1 question(s) below.
This PR drops the gh run view probe and retries gh run watch itself, up to 12 times 5s apart, when gh reports a run-fetch HTTP 404. It adds subprocess tests that run the real workflow shell against a fake gh. The retry logic does what the description says. I found only small issues: a leftover comment, a wasted final sleep and a stale branch in the fake gh. One open question is whether to retry only on gh's 404 text or on any first-lookup failure, as the old probe did.
Questions
- The retry now runs only when gh's stderr starts with
failed to get run: HTTP 404:. That ties it to gh's error wording, and a transient 5xx on the first lookup now fails the wrapper. At base, any non-zero exit from thegh run viewprobe was retried. Is matching the exact 404 text intended, or would you rather keep a lookup probe that retries any failure (for example,viewplus a short delay beforewatch), or also matchHTTP 5[0-9][0-9]:? (non-blocking)
Comments outside the changed lines
- [nit]
.github/scripts/test_cli_pr_review.py:46: The workflow no longer callsgh run view, but the fakeghstill answers it with adatabaseId. That makes it look as if the probe is still exercised. Could you drop this branch so a strayviewcall falls through toexit 99, or assert thatviewis never called?
| echo 'To request another review, comment `/review` on the PR.' >> "$GITHUB_STEP_SUMMARY" | ||
| # A newly dispatched run can briefly return 404 before GitHub indexes it. | ||
| # A newly dispatched run can briefly return 404 before GitHub indexes it, | ||
| # even after a successful view. Retry watch with at most one minute of delays. |
There was a problem hiding this comment.
[nit] "even after a successful view" refers to the gh run view probe this hunk removes. A reader now sees no view before watch. Could this say something like "gh run watch can return 404 for a newly dispatched run before GitHub indexes it; retry the same run up to 12 times, 5s apart"?
There was a problem hiding this comment.
That phrase records the observed failure that motivated removing the separate probe: view succeeded, then watch immediately returned the run-fetch 404. It is historical rationale for retrying watch directly; it does not describe an additional call in the new loop. I have kept that context with the indexing-race comment.
| if ! grep -q '^failed to get run: HTTP 404:' "$RUNNER_TEMP/review-watch.err"; then | ||
| exit "$status" | ||
| fi | ||
| sleep 5 |
There was a problem hiding this comment.
[nit] After the 12th 404 the loop still runs sleep 5 before it prints the error on line 114, so a persistent 404 waits 5s for nothing. test_persistent_not_found_is_bounded locks this in with ["5"] * 12. Should the loop skip the sleep when attempt is 12, or is that not worth it?
There was a problem hiding this comment.
This keeps the existing twelve-attempt, sixty-second retry-delay policy unchanged, including the final delay. Skipping the last sleep would be a reasonable small cleanup, but is unnecessary to repair this race. The persistent-404 regression deliberately verifies that existing bound; the twenty-minute job timeout still bounds total time including watch.
|
Yes, limiting retries to the run-fetch 404 is intentional. This repair targets the observed indexing race and retries the exact dispatched run. Auth/permission failures, backend failures and other errors (including 5xx) propagate. The old probe retried any failure, but retaining that behavior would also delay unrelated failures; the new regression cases check the narrower contract. The fake |
Changes
Retry the same dispatched review run when
gh run watchreports a run-lookup HTTP 404. Keep twelve attempts, at most sixty seconds of retry delays, and the existing twenty-minute job timeout. Backend failures and other errors still fail the wrapper.Why
GitHub can return 404 from
watchimmediately afterviewsucceeds for a newly dispatched run. The wrapper currently exits even if the backend review later succeeds. This fix takes effect for future review requests after it merges tomain.Tests
gh: transient and persistent 404s, same-run identity and single dispatch, backend failure/cancellation/timeout, and non-404 error propagation. All 20 authorization and wait tests pass; the new transient-404 regression fails on unchangedmain.This PR was written by Codex.