You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(github): a remote host URL rejects no longer breaks GitHub resolution - #41232
A repository with a normal github.com origin could not resolve its GitHub repository or pull requests if any other remote had a host that the URL parser rejects. Examples are an SSH alias such as nas.08 or an IPv6 SCP remote such as git@[2001:db8::1]:team/repo.git. gitHubApiHostForRemote now treats such a remote as non-GitHub and skips it instead of throwing TypeError: Invalid URL.
Commit d775f66 (origin/main). 1) Called gitHubApiHostForRemote directly from the worktree with node: git@nas.08:team/repo.git, git@08:team/repo.git, git@node.256:team/repo.git and git@[2001:db8::1]:team/repo.git each throw TypeError: Invalid URL, and resolveGitHubRepository with origin=git@github.com:pingdotgg/t3code.git plus backup=git@nas.08:team/repo.git throws at gitHubRepositoryResolution.ts:169. 2) Real app: started T3CODE_DEV_SEED=0 vp run dev, made a git repo on branch feature/x with origin=https://github.com/pingdotgg/t3code.git and backup=git@nas.08:team/repo.git, added it with t3 project add, paired the web client and opened a draft thread in that project. The server logged 'VCS remote status refresh failed' with defectTags ['TypeError'], and server.trace.ndjson shows TypeError: Invalid URL at gitHubApiHostForRemote (gitHubRepositoryResolution.ts:169) passing through GitHubSourceControlProvider.resolveRepository -> listByHead -> listChangeRequests -> findLatestPrForHeadContext -> lookupStatusPr -> GitWorkflowService.remoteStatus. Control: after git remote remove backup the 30 s retry passed with no new failure. 3) Added a test case to gitHubRepositoryResolution.test.ts; it fails on main with TypeError: Invalid URL (1 failed, 17 passed).
Evidence
Create a repository on feature/x with a normal GitHub origin plus secondary remotes git@nas.08:team/repo.git and git@[2001:db8::1]:team/repo.git. Open its thread in the real web client and request a full remote-status refresh. The terminal displays the actual server response.
GitHub status succeeds; PR lookup completes with null
Environment: Chromium web client, 1280×800, light theme, fresh isolated state on each commit, Replay provider. scenarios:prove exited 0: fails on base, passes on head.
Rendering an existing pull request was not exercised: the synthetic feature/x branch has no PR, so the successful lookup returned null.
The additional SSH aliases 08 and node.256 were not individually exercised; this run used nas.08 and the bracketed IPv6 remote together.
Tests
vp test run src/server/gitHubRepositoryResolution.test.ts (packages/source-control-github): 18 passed with the fix; without it, 1 failed and 17 passed (the repro test)
vp run check:changed: format, lint, knip, graphql, typecheck (11 packages) and tests (2 files, 20 tests) all passed
…tion
gitHubApiHostForRemote now treats a remote whose host WHATWG URL rejects
(an SSH alias like nas.08, a bracketed IPv6 SCP host) as non-GitHub
instead of throwing TypeError: Invalid URL.
Fixes#41221
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No actionable comments were generated in the recent review.
Walkthrough
The GitHub repository resolver now returns null when it cannot parse a remote host as a URL. A test checks that an invalid backup remote does not prevent resolution from selecting a valid origin remote.
Changes: GitHub remote resolution
Layer / File(s)
Summary
Host parsing and fallback coverage packages/source-control-github/src/server/gitHubRepositoryResolution.ts, packages/source-control-github/src/server/gitHubRepositoryResolution.test.ts
gitHubApiHostForRemote uses URL.parse and returns null if parsing fails. A test checks that resolution selects the valid origin remote when a backup remote has an invalid URL host.
#24383 — Both issues concern remote parsing failures during GitHub repository selection. This change handles URL-host parse failures but does not establish that local-path remotes or ranking behavior are addressed.
Possibly related PRs
pingdotgg/t3code#34130 — Both changes update remote handling in gitHubRepositoryResolution.ts and include tests for repository resolution.
Suggested reviewers:macroscopeapp
Merge Risk: Minimal · up to 44377
Secondary remotes with hosts the URL parser rejects, such as SSH aliases or IPv6 SCP URLs, no longer break GitHub repository resolution. Resolution continues with the valid github.com remote. The change is small and covered by a regression test, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix and the area: a remote host URL that the parser rejects no longer breaks GitHub resolution. The main change in the changeset is that gitHubApiHostForRemote skips such remotes i…
Linked Issues check
[#41221] requires gitHubApiHostForRemote to return null instead of throwing for remote hosts that WHATWG URL rejects, so that a normal github.com origin still resolves. At the reviewed head, gitHubApi…
Out of Scope Changes check
The whole-PR diff (merge base d775f66 to head 443771f) changes only gitHubRepositoryResolution.ts in the gitHubApiHostForRemote function (+3/-1) and adds a regression test to gitHubRepositoryResolut…
Description check
The description covers the problem (a github.com origin fails to resolve when another remote has a host that WHATWG URL rejects), the change (remote treated as non-GitHub and skipped), scope (links is…
Full details: Title check
Explanation
The title names the fix and the area: a remote host URL that the parser rejects no longer breaks GitHub resolution. The main change in the changeset is that gitHubApiHostForRemote skips such remotes instead of throwing, so the title matches the main change. It is specific and follows the conventional commit form.
Full details: Linked Issues check
Explanation
[#41221] requires gitHubApiHostForRemote to return null instead of throwing for remote hosts that WHATWG URL rejects, so that a normal github.com origin still resolves. At the reviewed head, gitHubApiHostForRemote (gitHubRepositoryResolution.ts) replaces new URL(...) with URL.parse(...) and returns null when parsing fails. The non-throwing null path feeds resolveGitHubRepository, which skips null hosts when choosing origin, so origin resolves to github.com/pingdotgg/t3code. The five call sites named in the issue receive null instead of a defect, so they are covered by the same change. The raw summary reports a regression test in gitHubRepositoryResolution.test.ts for the listed hosts (nas.08, 08, node.256, bracketed IPv6). I did not inspect the test file directly, so that part rests on the summary. The definition.recognizeRemote call was not inspected for throw paths. The issue's expected behavior is met by the source change. The PR's reproduction and test results are reported by the author and are not re-run here.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff (merge base d775f66 to head 443771f) changes only gitHubRepositoryResolution.ts in the gitHubApiHostForRemote function (+3/-1) and adds a regression test to gitHubRepositoryResolution.test.ts (+24/-0). Both changes serve issue #41221. parseGitRemoteHost in packages/source-control-core is not modified. The PR description and the linked issue both exclude that parsing policy from this change. No unrelated changes were found in the reviewed diff.
Full details: Description check
Explanation
The description covers the problem (a github.com origin fails to resolve when another remote has a host that WHATWG URL rejects), the change (remote treated as non-GitHub and skipped), scope (links issue #41221 and explains the excluded parseGitRemoteHost behavior), and verification (a reproduction on main, a before/after table, focused and repo-wide test results, and CI status). It also lists what was not exercised and who did the work. It deviates from the template in heading names and omits a conventional-commit title, but the required information is present.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
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
size:XS0-9 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
1 participant
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.
A repository with a normal github.com origin could not resolve its GitHub repository or pull requests if any other remote had a host that the URL parser rejects. Examples are an SSH alias such as
nas.08or an IPv6 SCP remote such asgit@[2001:db8::1]:team/repo.git.gitHubApiHostForRemotenow treats such a remote as non-GitHub and skips it instead of throwingTypeError: Invalid URL.Fixes #41221
Reproduction on main
Commit d775f66 (origin/main). 1) Called gitHubApiHostForRemote directly from the worktree with node: git@nas.08:team/repo.git, git@08:team/repo.git, git@node.256:team/repo.git and git@[2001:db8::1]:team/repo.git each throw TypeError: Invalid URL, and resolveGitHubRepository with origin=git@github.com:pingdotgg/t3code.git plus backup=git@nas.08:team/repo.git throws at gitHubRepositoryResolution.ts:169. 2) Real app: started
T3CODE_DEV_SEED=0 vp run dev, made a git repo on branch feature/x with origin=https://github.com/pingdotgg/t3code.git and backup=git@nas.08:team/repo.git, added it witht3 project add, paired the web client and opened a draft thread in that project. The server logged 'VCS remote status refresh failed' with defectTags ['TypeError'], and server.trace.ndjson shows TypeError: Invalid URL at gitHubApiHostForRemote (gitHubRepositoryResolution.ts:169) passing through GitHubSourceControlProvider.resolveRepository -> listByHead -> listChangeRequests -> findLatestPrForHeadContext -> lookupStatusPr -> GitWorkflowService.remoteStatus. Control: aftergit remote remove backupthe 30 s retry passed with no new failure. 3) Added a test case to gitHubRepositoryResolution.test.ts; it fails on main with TypeError: Invalid URL (1 failed, 17 passed).Evidence
Create a repository on
feature/xwith a normal GitHub origin plus secondary remotesgit@nas.08:team/repo.gitandgit@[2001:db8::1]:team/repo.git. Open its thread in the real web client and request a full remote-status refresh. The terminal displays the actual server response.TypeError: Invalid URLnullEnvironment: Chromium web client, 1280×800, light theme, fresh isolated state on each commit, Replay provider.
scenarios:proveexited 0: fails on base, passes on head.Scenario driver · Sanitized live RPC responses
Not shown:
Tests
vp test run src/server/gitHubRepositoryResolution.test.ts(packages/source-control-github): 18 passed with the fix; without it, 1 failed and 17 passed (the repro test)vp run check:changed: format, lint, knip, graphql, typecheck (11 packages) and tests (2 files, 20 tests) all passedNot in this change
Who did the work
Run by the t3code factory in T3 Code.