Skip to content

fix(review-at-head): a hung gh call times out as a failed API call - #4023

Merged
mabry1985 merged 2 commits into
mainfrom
fix/254-review-at-head-gh-timeout
Oct 3, 2026
Merged

mabry1985 merged 2 commits into
mainfrom
fix/254-review-at-head-gh-timeout

Conversation

@mabry1985

@mabry1985 mabry1985 commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Part of protoLabsAI/pr-reviewer-plugin#254 (the plugin side is protoLabsAI/pr-reviewer-plugin#256).

scripts/review_at_head.py's _gh called subprocess.run with no timeout, so a hung gh held the required Review at head job until the Actions job timeout, and the status it should have posted never came. _gh now passes timeout=GH_TIMEOUT_S (120s), and a TimeoutExpired is re-raised as the same RuntimeError a failed call raises. Both modes already handle that fail-closed ("a broken API call must not be mistaken for no verdict"): single-PR mode posts no status from a partial read and exits 0, and the sweep moves on to the next PR. The change is outside the vendored supersede block, so the block's hash is unchanged and this is a plain edit, the same as in the plugin's copy.

It also strengthens test_the_STRICTEST_round_for_a_head_wins_not_the_latest (item 3). The rounds are tagged, and the test asserts that the earlier round 1 FAIL is the one picked over round 2's later PASS, plus the exact failure description. It also asserts that the newest of equally strict rounds speaks, and that an earlier WARN beats a later PASS. Before, it only checked not ok and "FAIL" in the description, which a wrong pick could also satisfy.

Scope: the script, its test, and the changelog.d fragment.

Tests: a hung gh raises a timeout RuntimeError, and the timeout is actually passed to subprocess.run. A timed-out reviews read posts no status and still exits 0. Locally: pytest tests/test_review_at_head.py passes (55 tests), and ruff==0.15.10 check is clean on both files.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Review checks now stop waiting for a command after two minutes. If a review read times out, no status is posted from incomplete results, and the check exits cleanly.
    • When reviews have equally strict verdicts, the newest review round is selected, regardless of the order in which rounds are processed.

GitHub CI and others added 2 commits October 2, 2026 20:11
…he strictest-round test proves which round spoke

`_gh` had no subprocess timeout, so a hung `gh` held the required job until the Actions job
timeout. It now passes timeout=120s, and TimeoutExpired raises the same RuntimeError as a
failed call, which both modes already handle fail-closed. Outside the vendored block.

The strictest-round test now asserts the FAIL came from the earlier round, not a later one.

Part of protoLabsAI/pr-reviewer-plugin#254

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 549242e7-e1e6-4996-b6b6-d1bfeebd1491
📥 Commits

Reviewing files that changed from the base of the PR and between d65a20c and 9e89053.

📒 Files selected for processing (3)
  • changelog.d/4023.fixed.md
  • scripts/review_at_head.py
  • tests/test_review_at_head.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

GitHub CLI calls now have a 120-second timeout. Timed-out calls are reported as failures, and a timed-out reviews read does not post a status. Tests also check verdict precedence across review rounds.

Changes

GitHub CLI timeout

Layer / File(s) Summary
Bound GitHub CLI calls
scripts/review_at_head.py, tests/test_review_at_head.py, changelog.d/4023.fixed.md
_gh passes a 120-second timeout to subprocess.run and converts timeouts to RuntimeError. Tests check that a timed-out reviews read emits a timeout message, exits zero, and does not post a status. The changelog describes this behavior.

Review-round selection test

Layer / File(s) Summary
Verify strictest-round precedence
tests/test_review_at_head.py
The test checks that the stricter verdict wins regardless of review order, the newest round wins among equally strict failures, and WARN wins over PASS.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Sequence Diagram(s)

sequenceDiagram
  participant main
  participant _gh
  participant subprocess.run
  main->>_gh: Read reviews
  _gh->>subprocess.run: Run gh with a 120-second timeout
  subprocess.run-->>_gh: Raise TimeoutExpired
  _gh-->>main: Raise RuntimeError
  main->>main: Report timeout and exit zero without posting status
Loading

Merge Risk: ⚪ Minimal · up to 9e890

GitHub CLI calls now have a 120-second limit, and timed-out review reads do not publish a status. No actionable merge-blocking risk is established by the supplied change context.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: a hung gh call now times out and is treated as a failed API call.
Description check ✅ Passed The description explains the change, its context, and the test results. It does not use the template’s ## Summary, ## Test plan, or ## Checklist headings, and it does not state whether this PR c…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@protoreview protoreview Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA panel review — PASS

code-review · head 9e890531b831 · formal

PR #4023 came back clean across all four review angles — no defects were identified by the panel, and the verifier confirmed there was nothing to verify. No blockers, majors, minors, or nits to report. The change is safe to merge from a code-review standpoint.

No findings — the review came back clean.

findings JSON (machine-readable)
[]

@protoreview protoreview Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA panel review — PASS

code-review · head 9e890531b831 · formal

PR #4023 is clean: all four review lanes (correctness, cross-file, style, and tool-sourced) returned no findings, and the verifier confirmed there is nothing to re-check. No defects, no disagreements, no coverage gaps. Nothing to fix before merge.

No findings — the review came back clean.

findings JSON (machine-readable)
[]

@protoreview protoreview Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promoting the PASS verdict for head 9e890531b831: all checks terminal-green, zero unresolved review threads. (approve-on-green)

@mabry1985
mabry1985 merged commit 46773d3 into main Oct 3, 2026
25 checks passed
@mabry1985
mabry1985 deleted the fix/254-review-at-head-gh-timeout branch October 3, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant