[Bug]: Remotes on ssh.bitbucket.org (forge SSH hosts) don't match their PRs' repository #22620
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
owner/repo is a placeholder.
- Clone a Bitbucket repo through Bitbucket's own SSH host:
git@ssh.bitbucket.org:owner/repo.git(Bitbucket documents this host; it's also whatHostNamepoints to in many~/.ssh/configsetups). - Register the checkout as a project. Its
repositoryIdentity.canonicalKeybecomesssh.bitbucket.org/owner/repo(provider correctly detected asbitbucket). - Ask T3 to write a review guide for a PR in
bitbucket.org/owner/repo.
Expected behavior#
The project is matched to the PR's repository and the guide is written.
Actual behavior#
Guides are written from this project's checkout, and this pull request is in another repository. Write it from a project that is a checkout of that repository.
The canonical key keeps the SSH host (ssh.bitbucket.org), while the PR's repository is keyed by bitbucket.org, so the comparison fails. Changing the remote to git@bitbucket.org:owner/repo.git works around it.
The same likely applies to ssh.github.com (GitHub's SSH-over-443 host) and any other forge SSH hostname that differs from its web host.
Impact#
Minor bug or occasional failure
Version or commit#
T3 Code (Alpha) 0.1.1
Environment#
macOS 26 (Darwin 25.6.0), desktop app
Workaround#
Point the remote at the web host: git remote set-url origin git@bitbucket.org:owner/repo.git (SSH still works if ~/.ssh/config maps bitbucket.org to HostName ssh.bitbucket.org), then reload the project.
Suggested fix#
Normalize known forge SSH hosts to their web host when building the canonical repository key (ssh.bitbucket.org → bitbucket.org, ssh.github.com → github.com), or compare by provider + owner + name instead of the raw host.
Related: #17805 (SSH host aliases classified as provider unknown) — different symptom, same root area (remote host → repository identity).
This issue was diagnosed and written by Claude Opus 5.5 (Claude Code, running in T3 Code).
juliusmarminge added labelsbug
juliusmarminge added labelsaccepted
juliusmarminge added labelsvia-triage
@juliusmarminge is there something that's still required to get this moving?
fwiw I get this on ssh.github.com, and the Create PR button in thread details fails because of it. The error hint was misleading too:
Source control provider github failed in listChangeRequests: No GitHub credential for ssh.github.com: run `gh auth login --hostname ssh.github.com`.Additional symptom of the same root cause: sidebar PR clicks fall back to the external browser.
Environment
- T3 Code (Beta) 0.1.8, macOS 26
- Remote:
git@ssh.bitbucket.org:owner/repo.git(migrated fromgit@bitbucket.org:...following Atlassian's SSH hostname change; brownouts start Nov 12, 2026, so this remote form will become the norm for Bitbucket SSH users) - Bitbucket auth via Atlassian email + scoped API token works: API calls return 200 (
/2.0/user,pullrequests/<n>, diffstat/statuses, etc.)
Steps
- Register the checkout above as a project (
repositoryIdentity.canonicalKey = ssh.bitbucket.org/owner/repo, provider correctly detected asbitbucket). - Open a thread on a branch with a PR. The thread details sidebar shows the PR.
- Click the PR in the sidebar.
Expected Internal PR view opens (
pullRequestLinksOpenInApp = true, setting unchanged).Actual PR opens in the default browser instead. Desktop logs show
ElectronShell.openExternalat click time.Analysis The internal viewer itself works — opening via
+ → Pull requestin the workspace menu renders the PR internally. Only URL-based resolution from the sidebar row fails:- Project host derived from the canonical key is
ssh.bitbucket.org. - PR web/API URL host is
bitbucket.org. isChangeRequestOnProjectHostrequires strict equality (projectHost === link.host || projectHost === link.authority), so the sidebar click's reverse URL resolution returns no match and the click handler falls back toopenExternal.- Before the SSH remote migration (
git@bitbucket.org:...), the same click opened internally.
Related observation: for this remote,
recognizeRemoteclassifies the host as "Bitbucket Self-Hosted" (baseUrl: https://ssh.bitbucket.org), which also produced linked-PR records with hostssh.bitbucket.org/ URLs likehttps://ssh.bitbucket.org/owner/repo/pull-requests/<n>.So beyond review guides (original report), this affects everyday PR navigation. The fix in #22625 (normalizing
ssh.bitbucket.org → bitbucket.orgin the repository key) likely addresses it once registered projects re-resolve their stored identity; noting the extra surface in caseprojectChangeRequestHost-based matching needs the same normalization.Local workaround: keep
bitbucket.orgin the Git remote URL and let SSH connect tossh.bitbucket.org:# ~/.ssh/config Host bitbucket.org HostName ssh.bitbucket.orgPreserve any existing port and identity settings. Then update the affected repository:
git remote set-url origin git@bitbucket.org:OWNER/REPO.git git ls-remote origin HEADReload T3 Code to refresh its cached repository identity. These changes are local; nothing needs committing or pushing.
Verified that Git access works with this configuration.
Still reproduces on nightly
0.1.12-nightly.20261120.4994(Windows 11, desktop app, Bitbucket Cloud). Same symptom: PR links in a thread open in the external browser instead of the in-app preview.- Remote
git@ssh.bitbucket.org:owner/repo.git→ projectcanonicalKeyisssh.bitbucket.org/owner/repo, providerbitbucket. - The link host is
bitbucket.org, soprojectChangeRequestHost(packages/source-control-core/src/shared/definition.ts:533) never equals it, andresolvePullRequestPreviewTargetreturnsnull. This also blocks the same-host fallback (findProjectOnChangeRequestHost), so no Bitbucket project can serve the link. packages/source-control-bitbucket/src/shared/definition.tsstill defines norepositoryKeyFromRemote, even though line 127 notes that Cloud also clones fromssh.bitbucket.organdaltssh.bitbucket.org. Same onmaintoday.
With Bitbucket moving SSH to
ssh.bitbucket.org, this will hit every Bitbucket SSH user.Workaround confirmed on this build:
Host bitbucket.org/HostName ssh.bitbucket.orgin~/.ssh/config, remotegit@bitbucket.org:owner/repo.git, then re-add the project.sshResolvedRemoteUrlskipsssh -Gfor public forge hosts, so the key staysbitbucket.org/....Related: if the remote uses a custom SSH alias (
Host work-bb→HostName ssh.bitbucket.org), the provider is alsounknown(#17805).RepositoryIdentityResolver.ts:202recognizes the provider from the raw remote, not from thessh -Gresult used for the key.Triaged with Claude Opus 5.5 (Claude Code,
t3 triage).- Remote
Note
Claude Opus 5.5 responding on behalf of shivam
Closing as fixed by #42330 (merged in 01962d4c0b on Nov 24, after the last report above).
The cause reported on Nov 20 was a project key of
ssh.bitbucket.org/owner/repoagainst a PR link onbitbucket.org. Onmain, remotes onssh.bitbucket.organdaltssh.bitbucket.orgare keyed underbitbucket.org, and keys already saved under those hosts compare equal.packages/source-control-bitbucket/src/shared/definition.test.tscovers both:- "names %s on bitbucket.org, where its pull requests live" covers SCP-style,
ssh://…:443and HTTPS remotes. - "matches pull requests for a key saved under %s" checks
isChangeRequestInRepositoryandcanReadChangeRequestOnHost.
The sidebar and in-app PR links go through those same two checks (
packages/client-runtime/src/changeRequestLinks.ts,apps/web/src/lib/openPullRequestLink.ts), so PR clicks should open in the app again.If it still happens on a build that includes #42330, reply here with your remote and the PR link and it will be reopened.
- "names %s on bitbucket.org, where its pull requests live" covers SCP-style,
shivamhwp(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Note
Grok responding on behalf of Julius.
Thanks for the clear report. Current main matches it. The repository key is built from the remote's host and path as written (
packages/shared/src/git.ts:144-174). The only forge whose SSH host gets mapped to the same key as its web host is Azure DevOps (lines 129-142). Sogit@ssh.bitbucket.org:owner/repokeys asssh.bitbucket.org/owner/repo, while the pull request's repository keys asbitbucket.org/owner/repo, and the two never match. The same would apply tossh.github.com, GitHub's SSH host on port 443.Switching the remote to
git@bitbucket.orgworks, butssh.bitbucket.orgis a host Bitbucket documents itself, so it shouldn't need a workaround. This is separate from #17805, which is about custom SSH aliases from your own SSH config. These are fixed hosts the forges publish, so they can be recognized directly.Accepting this as a bug.