This repository was archived by the owner on Oct 21, 2026. It is now read-only.
Repository navigation
fix(server): repository identity prefers the gh default remote - #42
Merged
Merged
Conversation
A fork with both `origin` and `upstream` resolved its repository identity to `upstream`, so PR lookups and "View PR" pointed at the upstream repo. When `gh repo set-default` has marked a remote (`remote.<name>.gh-resolved base`), use that remote before falling back to upstream, origin, then alphabetical. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`gh repo set-default` stores OWNER/REPO instead of `base` when the chosen parent repository has no remote. Resolve it on the marked remote's host. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 Changed
RepositoryIdentityResolvernow checks for a remote marked bygh repo set-defaultand prefers it.ghstoresremote.<name>.gh-resolvedasbasefor that remote's own repo, or asOWNER/REPOwhen the chosen parent repo has no remote. The second case resolves to that repo on the marked remote's host, the same wayghdoes. Only after that does it fall back to the existing order:upstream, thenorigin, then the first remote alphabetically. Resolving an identity reads that config with onegit config --get-regexpcall, which runs in parallel withgit remote -v. It only runs on a cache miss.Why
In a fork with both
origin(the fork) andupstreamremotes, the project's repository identity always resolved toupstream. That identity also drives PR detection, lookup and linking, so a fork's PRs were looked up against the upstream repo and "View PR" opened the wrong one.ghusers already record which repo PRs belong to withgh repo set-default, so honoring it fixes forks without adding a setting. Repos where no default is set behave exactly as before.Checklist
Model: Claude Opus 5.5 (1M context), running in Claude Code inside T3 Code.
🤖 Generated with Claude Code