fix(server): preserve spaces in Git remote URLs #34324
main fromrefs/pull/34324/head·merged by maria-rcks View on GitHubProblem#
With git remote add origin '/tmp/team repos/shared.git', Git lists the remote correctly, but T3 drops its fetch and push entries. ensureRemote then attempts to add origin again and fails because that name already exists. listRemotes also returns an empty list.
Change#
Both VCS parsers now use Git's tab and direction separators to preserve the complete URL field. Fetch/push handling, CRLF and partial-clone annotations remain supported. The regression checks remote reuse, collision suffixing, distinct push URLs and preservation of the configured URLs, including leading/trailing whitespace and literal direction markers in paths.
Scope and approval#
This qualifies as a very small, focused fix for an obvious bug: an existing remote disappears solely because its local path contains spaces. It changes the two VCS parsers responsible for that failure, without contracts, UI changes or parser consolidation. The other three verbose-remote parsers serve repository identity (which intentionally excludes local paths) and host-specific provider operations.
Credit to @yashranaway's earlier fix in #11390. It was closed unmerged with a maintainer request to rebuild on current main with a newer model. This fix was independently reproduced and rebuilt on current main, including the second VCS parser. #28769 leaves URL spaces unresolved and owns parser consolidation; #29625 addresses multiple configured URLs, a separate problem.
Verification#
Linux ARM64, Git 2.56.0. New real-Git regressions before the fix: 4 failed, 1 passed (the existing HTTPS/SSH row). After the fix, the focused remote-operation and listing run: 29 passed.
A separate runtime program constructed the actual server Git services, created temporary repositories and real bare remotes under team repos, configured separate fetch/push URLs and a partial-clone filter, and called listRemotes and ensureRemote:
Before After
listRemotes [] origin, exact fetch/push URLs
ensureRemote(fetch URL) GitCommandError (exit 3) origin
ensureRemote(distinct push URL) GitCommandError (exit 3) origin-1
Git's final listing confirmed that origin retained both URLs and origin-1 used the requested URL. No client UI or Windows runtime verification was performed; this is a server parser fix.
vp run check:changed upstream/main: format, lint, both knip passes, generated GraphQL, typecheck of 3 affected packages and all 328 tests in the 3 affected test files passed. The branch was then cleanly rebased onto current main, with unchanged behavior diff and the server runtime reproduction passing again.
Reviewed with review-loop: 1 round with Claude Opus 5.5 on high. Reviewer verdict: approved. No blockers or should-fix findings; shared-parser consolidation remains with #28769.
Created with GPT-6.1 Sol in the Codex harness through T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
7729934Macroscope's review found this PR approvable — The change preserves spaces in Git remote URLs when listing and matching existing remotes. It leaves remote operations and configuration-write safeguards unchanged, with no obvious material risk requiring human judgment.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review.
Walkthrough
-
The remote listing parsers now handle LF and CRLF output and preserve spaces in URLs. Tests cover remote URL parsing and remote selection.
Changes: Git remote URL parsing
Layer / File(s) Summary Parse and validate remote listings
apps/server/src/vcs/GitVcsDriver.ts,apps/server/src/vcs/GitVcsDriverCore.ts,apps/server/src/vcs/GitVcsDriver.test.ts,apps/server/src/vcs/GitVcsDriverCore.test.tsBoth parsers use Git’s tab-delimited remote format and support LF or CRLF output. Tests check URLs containing spaces and remote selection. Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#28769: Replaces the same remote parsers with a shared
parseGitRemoteEntriesimplementation.
Suggested reviewers:
juliusmarminge - pingdotgg/t3code#28769: Replaces the same remote parsers with a shared
Merge Risk:
Minimal · up to5fbcc-
This server-side fix keeps spaces in Git remote URLs, so listing remotes and reusing an existing remote name should work as intended. No merge-blocking risk remains.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly and concisely describes the main change: preserving spaces in Git remote URLs in the server. Description check The description covers the required Problem, Change, Scope and approval, and Verification sections. It explains the bug, implementation, scope rationale, regression coverage, observed results, limitat… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Description check
-
Explanation
The description covers the required Problem, Change, Scope and approval, and Verification sections. It explains the bug, implementation, scope rationale, regression coverage, observed results, limitations, and review context.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: faa8ad6
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
afe03c91-6dbe-4d34-9ae5-50026f7d4e56
Commits-
Reviewing files that changed from the base of the PR and between faa8ad681861430740c5adfc225540eaf3e46272 and 5fbccaef59ca203576d1a38114341f09f0099e1c.
Files selected for processing: 4-
apps/server/src/vcs/GitVcsDriver.test.tsapps/server/src/vcs/GitVcsDriver.tsapps/server/src/vcs/GitVcsDriverCore.test.tsapps/server/src/vcs/GitVcsDriverCore.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
-
Note
Written by
claude-opus-5-5on behalf of MariaVerified in a real dev environment#
Linux, Git 2.43.0,
vp run devweb client driven with Playwright + Chrome. Basegithub/mainatd2c25950b4, PR head5fbccaef59.Scenario: a clone of
octocat/Hello-World(origin on GitHub) that also has a remote namedprakashk7475-lgtmpointing at/home/user/scenario/team repos/prakashk7475-lgtm.git. In the app I added the folder as a project, typed#11724(a fork PR from that owner) in the ref picker, chose Checkout pull request → Worktree, then sent a Claude Haiku 5.5 turn asking forgit status -sbandgit remote -v.main: the space-path remote is dropped by the parser, so
ensureRemotetriesgit remote add prakashk7475-lgtm ...and fails:WARN GitManager.configurePullRequestHeadUpstream failed cause: { _tag: 'GitCommandError', operation: 'GitVcsDriver.ensureRemote.add', exitCode: 3 } $ git config branch.t3code/pr-11724/feature/my-first-change.remote (empty)The PR branch has no upstream, and the git panel offers "Push & create PR" for a PR that already exists.


PR: the existing remote is seen, the fork gets
prakashk7475-lgtm-1, and the branch tracks it. No warning in the server log.$ git remote -v prakashk7475-lgtm /home/user/scenario/team repos/prakashk7475-lgtm.git (fetch) prakashk7475-lgtm-1 https://github.com/prakashk7475-lgtm/Hello-World (fetch) $ git branch -vv + t3code/pr-11724/feature/my-first-change 253c119 [prakashk7475-lgtm-1/feature/my-first-change] ...The git panel shows the
#11724PR link and the thread row shows the PR badge.

Nearby behavior on the PR build:
- GitHub provider detection from
listRemotesstill works: the ref picker offers "Checkout pull request" and the PR resolves. - Checking out the same PR again from a new thread reuses the worktree and
prakashk7475-lgtm-1(no-2remote, no warnings).
CI is green on
5fbccaef59.Not verified#
- Windows Git output (CRLF) in a running app; covered only by the PR's unit tests.
- The publish-repository path (
ensureRemoteafter creating a hosted repo), since it would create a real repository. - Partial-clone (
[blob:none]) remotes in the running app.
- GitHub provider detection from
tanstack-source added labelsbug
maria-rcks merged this1b42b16
maria-rcks closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes