t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: PR lookup misses renamed origin when GH_REPO uses the current name

Open STiFLeR7 opened this issue 1 day ago • 0 comments

Before submitting

  • [x] I searched issues and open PRs. #45925 was closed by #45951, which fixes lookup when the renamed remote is also the provider's default target.
  • [x] I included a fixture and a public GitHub example.

Area

apps/server

Steps to reproduce

  1. Use a branch that tracks origin and already has a same-repository PR. Keep the remote URL on the repository's old name after a rename.
  2. Start T3 Code with GH_REPO set to the repository's current name.
  3. Look up the branch PR. The Version Control section uses the GitManager.branchPullRequest path.

The public fixture is PR #45948 on factory/issue-45859, with origin on https://github.com/pingdotgg/t3-code.git and GH_REPO=pingdotgg/t3code. GitHub returns repository ID 1153130349 for both names and marks #45948 as same-repository.

Expected behavior

The branch lookup returns its existing PR because the tracked remote and the selected target resolve to the same repository.

Actual behavior

GitManager.branchPullRequest returned null with the canonical override. The old remote without the override returned #45948 after #45951. Using the current name for both the remote and override also returned #45948. An override targeting a genuinely different repository under the same owner was correctly rejected.

I reproduced this through the real service with local Git and fixture PR data, and checked the target decision separately through the GitHub provider. createsChangeRequestsIn compares the configured slugs, so the alias pair gets classified as cross-repository. The matcher then rejects the same-repository PR. The review thread has the comparison. I did not create a live PR or drive the desktop UI.

Impact

Minor bug or occasional failure. The existing PR is missing from T3 Code's branch lookup for this configuration.

Version and environment

Windows, Node 26.13.1. The tested #45951 revision was 684c8682. GitHub reports identical blobs for the Git manager and GitHub provider on main at 1002f254d2.

Workaround

Use the current repository name for origin, or unset GH_REPO when the checkout already identifies the intended target.

STiFLeR7 avatar Nov 30 '26 09:11 STiFLeR7