Skip to content

fix(sync): open the sync PR through the GitHub REST API, so it also opens from a cloud session - #59

Merged
flipvh merged 2 commits into
mainfrom
fix/pr-create-rest
Oct 25, 2026
Merged

flipvh merged 2 commits into
mainfrom
fix/pr-create-rest

Conversation

@flipvh

@flipvh flipvh commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

In a Claude cloud session gh pr create gets a 403, because the GitHub proxy there serves only the REST API. The sync now opens its PR with gh api repos/{owner}/{repo}/pulls -X POST, which works locally too and keeps the body the sync builds. When the create fails (a PR for the branch already exists returns a 422), it looks up the open PR for the head branch and prints the existing fallback and manual step.

Conflicts with #58 in the import block of src/services/sync.ts: keep both imports.

Verification

  • pnpm check, pnpm test (30 files, 296 tests).
  • Against the live API: the lookup and the {owner}/{repo} placeholders return the right PR URL, and a refused create (head equals base) exits 1 with a 422. Nothing was created.

Size

Kind Added Removed Net
source +49 −12 +37
  • source: createPr in utils/gh.ts, the REST create plus the lookup of an existing PR; 7 comment lines. No test: one asserting the gh arguments would only mirror the code.

🤖 Generated with Claude Code

…pens from a cloud session

`gh pr create` runs on GraphQL, which the GitHub proxy of a Claude cloud
session refuses with a 403. The sync now posts to repos/<owner>/<repo>/pulls
with `gh api` (owner and repo from origin, or gh's own placeholders when
origin is not a GitHub URL). When the create fails, it looks up an open PR
for the same branch and prints the manual step as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the import conflict in sync.ts with #58: alignments imports from
main, getGitHubBaseUrl from this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@flipvh
flipvh merged commit f1351e5 into main Oct 25, 2026
7 checks passed
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