Repository navigation
feat(ship-pr): look the PR up before retrying a failed gh pr create - #72
Conversation
gh pr create can return HTTP 502 or a GraphQL error after GitHub created the PR, so a blind retry fails with 'already exists', and a REST fallback can skip a local body guard. This ports the rule that the personal library added after the core loop was promoted, so its deletion there does not drop it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A guard rejection no longer falls through to a REST create, a failed final POST is followed by a lookup, and the lookup keeps only PRs from the bound head repository. Codex review findings on the port. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Claude finished @chapati23's task in 3m 44s —— View job Review complete
Verdict: needs-changes (one P1 correctness bug; otherwise solid) SummaryThis is a docs-only port (confirmed:
Findings
Everything else — the guard/GraphQL/REST distinctions, the retry-once semantics, the never-draft and never-placeholder-body carry-overs, and the terminology ( |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| GraphQL error after GitHub created the PR, and it can also fail without creating one. A | ||
| local guard that rejects the body is no GitHub failure: fix the body and rerun the guarded | ||
| command. After every other failed create, look the branch up through REST, which does not | ||
| use GraphQL: `gh api -X GET repos/<BASE_REPO>/pulls -f head=<head owner>:<head branch> -f base=<base> -f state=open --jq '.[] | select(.head.repo.full_name == "<HEAD_REPO>") | .html_url'` |
There was a problem hiding this comment.
[P1] correctness: the lookup's --jq filter extracts .html_url, but the text immediately after says to bind it with published --state <file> --pr <N>. repo-trust-preflight.sh's published subcommand enforces [[ $pr =~ ^[0-9]+$ ]] (skills/babysit-pr/scripts/repo-trust/publish.sh:89) — it rejects anything that isn't a bare integer, so a URL like https://github.com/owner/repo/pull/123 fails with a usage error. Following this instruction literally breaks the one case it exists to handle (a create that actually succeeded).
Fix: extract .number (or emit both .number and .html_url, e.g. "\(.number) \(.html_url)") so there's a PR number to pass to --pr <N>, while still keeping the URL available for the "report the PR URL" step a few sentences later. The same gap applies to the "bind what the lookup finds" step after a second failed POST, since it reuses this same lookup command.
tl;dr
ship-prskill now says what to do when creating a pull request fails, because GitHub sometimes creates the PR anyway. The rule was written in the personal library after the core loop moved here, so without this port its deletion there would drop it.The Problem
gh pr createcan return HTTP 502 or a GraphQL error after GitHub created the PR; a blind retry then fails with "already exists".ship-prcopy predates that rule, and the personal copy is about to be deleted.The Solution
Validation
ship-pr-failed-create-lookup.node scripts/validate-skills.mjs(27 skills); the lookup command, run against a known branch, returned exactly its PR;skills/ship-pr/SKILL.mdis 496 lines.gpt-6.2-sol); its 3 P2 findings are fixed in the second commit. The fix commit was not re-reviewed by Codex before push.gh pr create; this is instruction prose with no executable test.Deferrals
Ship Checklist
type: summaryortype(scope): summary, ascommitlint.config.mjsenforces for commitsnode scripts/validate-skills.mjsand the affected test suites passAGENTS.md🤖 Generated with Claude Code