fix: list PRs without baseRefOid on old gh - #70
Merged
Conversation
`gh pr list --json baseRefOid` 404s the whole list on 2.45, which made every sweep look like GitHub was down. Take base SHAs from the pulls REST API instead. Co-authored-by: Cursor <cursoragent@cursor.com>
| // `gh pr list --json` on Ubuntu's 2.45 gh has headRefOid but not baseRefOid — unknown field → empty | ||
| // stdout, which the sweep used to log as "auth/network down". Pull base SHAs from REST instead. | ||
| function pullBaseOids(slug: string): Map<number, string> | null { | ||
| const r = exec('gh', ['api', `repos/${slug}/pulls?state=open&per_page=100`, '--paginate']) |
There was a problem hiding this comment.
🔴 · conf 0.9 · src/sweep/prs.ts:35
this breaks the large-backlog case this file already protects: gh api --paginate emits one JSON array per REST page, so with >100 open PRs JSON.parse(r.stdout) sees concatenated arrays and the sweep crashes. use gh's slurp mode or otherwise keep one schema-validated JSON value at this boundary.
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
gh2.45 supportsheadRefOidbut notbaseRefOid. Requesting it madegh pr list --jsonfail, and the sweep logged that as "auth/network down" every minute.gh api repos/.../pulls. Same forstupify review.Test plan
bun run typecheck/oxlint/oxfmt --checkMade with Cursor