fix: retry _gh_get once on transient network failure before giving up - #584
Open
essentialbit wants to merge 2 commits into
Open
fix: retry _gh_get once on transient network failure before giving up#584essentialbit wants to merge 2 commits into
essentialbit wants to merge 2 commits into
Conversation
Every paginating caller (pr_merge_planner.py, audit_stale_branches.py in PR #583, etc.) treats a falsy _gh_get() return as end-of-data via `if not batch: break`. A transient network error or 5xx mid-pagination returned None, which looked identical to a legitimate empty final page — silently truncating results with no error surfaced (hit once auditing branches: 172 -> 100, page 2 lost). One retry after a short delay closes that gap for every caller sharing this shared helper, without touching each script's loop shape individually.
This was referenced Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
community._gh_get()returnedNoneon any request exception or non-200 response, with no distinction from a legitimate final empty page.pr_merge_planner.py, andscripts/audit_stale_branches.pyin open PR chore: add read-only stale/orphan branch audit script #583) usesif not batch: break— a transient network hiccup mid-pagination silently truncated results instead of erroring. Hit once for real:audit_stale_branches.py's branch fetch silently dropped from 172 to 100 branches on page 2 before a manual re-run recovered it._gh_getitself before giving up, closing the gap for every caller of this shared helper without touching each script's own loop shape.Test plan
from community import _gh_getimports cleanlyfrom main import *still imports cleanly (shared module surface)requestsscratch verification (3 cases, all pass):None, exactly 2 attempts (bounded, no infinite retry)[]) on first try → returns[]immediately, no spurious retrytests/directory exists in this repo yet (consistent with other recent PRs)🤖 Generated with Claude Code