Skip to content
Source
Sign inSign up
TanStack/source

GitHub sync: headRefName returns refs/pull/N/head, and branches differ from GitHub #652

Closedtombeckenham opened this issue 0 comments
tombeckenhamcommented

Summary

On a repository synced from GitHub, src pr view N --json headRefName returns refs/pull/N/head for most pull requests, where gh returns the branch name. Tooling written for gh uses headRefName as a branch name and breaks.

Separately, the branches of the repository on Source do not match GitHub. The refs/pull/N/head refs do match.

Both could be by design. If they are, please say so and I will close this.

Repository: TanStack/ai. Measured on 2026-11-21 with git ls-remote against both hosts, gh pr list and src pr view.

1. headRefName is a pull ref, not a branch

Of 46 open pull requests on Source, 39 return refs/pull/N/head.

Compared with the 45 that are open on GitHub:

CountGitHub saysSource headRefNameHead branch on Source
24from a forkrefs/pull/N/headnot there
6same repositorybranch namesame commit as GitHub
4same repositoryrefs/pull/N/headsame commit as GitHub
6same repositoryrefs/pull/N/headnot there
5same repositoryrefs/pull/N/headolder commit than GitHub

Examples:

  • #979: branch taren/workflow-orchestration-rfc, Source returns the branch name. This is the result I expect.
  • #1955: branch 1935-ai-harness-rejected-receipt-resolves-before-durable-rejection-recovery-can-rerun-the-input is on Source at the same commit as GitHub, but headRefName is refs/pull/1955/head.
  • #2067: branch chore/renovate-all-deps is not on Source. headRefName is refs/pull/2067/head.
  • #1896: branch openui-tier-f is on Source at 7402cf3. GitHub's head is 463b7f8. headRefName is refs/pull/1896/head.

The 4 pull requests in row three show that a missing branch does not explain every case.

For a pull request from a fork, gh returns the branch name of the fork (for example fix/after-tool-hook-error for #1559).

Effect

A script that does git worktree add <path> "$headRefName", or names a local branch or a directory from it, fails. My review launcher opened 2 of 5 pull requests for this reason.

Wanted

headRefName returns the branch name that GitHub has, also for a pull request from a fork. If the pull ref is useful, give it in a different field.

2. Branches differ from GitHub

SourceGitHub
Branches165152
Only on this host229
Same name, different commit66
refs/pull/N/head1,6681,668
refs/pull/N/head with a different commit00
Tags (measured 2026-11-19)5,7485,748, all the same

main is the same on both.

Branches only on Source are possibly correct: they can be pull requests that stay on Source. The branches only on GitHub (9) and the ones at an older commit on Source (6) look like sync that did not run. Five of those six are the head of an open pull request (table above).

Wanted

One of these:

  • Sync brings each branch of GitHub to Source and keeps it current, or
  • the docs say that only release branches and pull refs sync, and headRefName still gives the branch name.

Not checked

My login is not an admin of TanStack/ai, so src github-sync status is refused. I do not know the release branches, the warnings, or if sync is paused.

  1. tombeckenham assignedtombeckenham

Sign in to join this conversation.