Skip to content

fix(github): a remote host URL rejects no longer breaks GitHub resolution - #41232

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-41221
Nov 23, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-41221

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

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.

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 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.

Before After
d775f66a15 443771fec6
TypeError: Invalid URL GitHub status succeeds; PR lookup completes with null
Before: live server remote-status defect After: successful GitHub remote status

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.

Scenario driver · Sanitized live RPC responses

Not shown:

  • 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
  • PR CI: all 39 checks passed on 443771f

Not in this change

  • parseGitRemoteHost accepts hosts that WHATWG URL rejects; whether it should reject them itself is a separate question and was left as is.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 23, 2026 04:47
…ak GitHub resolution

Reproduces #41221: gitHubApiHostForRemote throws TypeError: Invalid URL for
git@nas.08:…, git@08:…, git@node.256:… and git@[2001:db8::1]:… remotes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 7e5a439 · PR result: 443771f · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • #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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed [#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 Passed 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 Passed 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
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7e5a439 and 443771f.

Files selected for processing: 2

  • packages/source-control-github/src/server/gitHubRepositoryResolution.test.ts
  • packages/source-control-github/src/server/gitHubRepositoryResolution.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@juliusmarminge
juliusmarminge merged commit 12f19b8 into main Nov 23, 2026
40 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-41221 branch November 23, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: GitHub repository/PR resolution throws uncaught TypeError: Invalid URL when any remote uses an IPv6 SCP URL or SSH alias rejected by new URL

1 participant