fix(submit): do not mistake GitHub 5xx errors for a missing PR - #43
Open
amustafa wants to merge 1 commit into
Open
fix(submit): do not mistake GitHub 5xx errors for a missing PR#43amustafa wants to merge 1 commit into
amustafa wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
amustafa
force-pushed
the
am/submit-pr-survey-503
branch
from
August 19, 2026 14:56
009ac14 to
0d57b0d
Compare
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.
What
sr submitno longer offers to create PRs that already exist when GitHub's API has a bad moment.Why
The PR survey ran
gh pr view <branch>and treated any exit code 1 as "no PR exists". Butghalso exits 1 on server failures — during a real GitHub 503 spell, roughly a third of the survey calls failed per pass, each misread as "this branch has no PR", and submit prompted to create PRs for branches deep in review. Saying yes would at best fail on the duplicate; the prompt itself was the bug.How
ghPRForBranchnow classifies the failure bygh's stderr, not its exit code:no pull requests found→ genuinely no PR (nil, nil, as before)HTTP 5xx→ transient server failure, retried up to 3 attempts with 1s/2s backoff so one flaky call doesn't poison a whole stack surveyghstub inprepare_test.gonow prints the realno pull requests foundmessage — a bare exit 1 is exactly the ambiguity the fix refuses to interpret.ghtests of the real function (503-then-success retries and returns the PR; no-PR returns nil without error; a 401 surfaces as an error).🤖 Generated with Claude Code