fix(server): a project whose origin URL contains a space gets a repository identity #35080
main fromrefs/pull/35080/head·merged by juliusmarminge View on GitHubRepositoryIdentityResolver.parseRemoteFetchUrls matched git remote -v lines with /^(\S+)\s+(\S+)\s+((fetch|push)).../ after trimming, so a URL containing whitespace never matched; with no remote left the project got a null repositoryIdentity. It now parses each line the way git formats it (name, a tab, the URL, one space, then the direction), using the same regex GitVcsDriver and GitVcsDriverCore already use: /^(\S+)\t(.+) ((fetch|push))(?:\s+[[^]]+])?$/, splitting on \r?\n. Both other remote -v readers already handle spaces, so this was the only parser with the bug. Regex worst case: .+ backtracks against the fixed (fetch|push) suffix and the optional [...] tail, which is O(n^2) on one adversarial line at worst, in practice linear. The input is local git remote -v output, which the user controls.
Fixes pingdotgg/t3code#35034
Reproduction on main#
On origin/main ee90bdc940: created two git repos, app with origin ssh://git@git.example.test/team repos/app.git and control with origin ssh://git@git.example.test/team-repos/control.git. Started node apps/server/src/bin.ts serve --base-dir <fresh dir> --port 47734 with T3CODE_DEV_SEED=0, added both with t3 project add, issued a token with t3 auth session issue --json, then curl -H 'Authorization: Bearer …' -H 'x-t3-orchestration-protocol: 2' /api/orchestration/shell | jq '.projects[] | {title, identity: .repositoryIdentity.locator.remoteUrl}' returned {"title":"app","identity":null} and {"title":"control","identity":"ssh://git@git.example.test/team-repos/control.git"}, exactly as reported. Added a test to RepositoryIdentityResolver.test.ts that fails on main; with GIT_CONFIG_GLOBAL=/dev/null (the VM has a global insteadOf rewrite that breaks two unrelated tests) only the new test fails.
Evidence#
Create synthetic app and control repositories with origins ssh://git@git.example.test/team repos/app.git and ssh://git@git.example.test/team-repos/control.git. On each commit, start the real Node server against a fresh database with T3CODE_DEV_SEED=0, add both projects through the CLI, issue a bearer session, and read /api/orchestration/shell using protocol 2 after control enrichment completes. Base returns a null identity for app; head preserves its full URL. Control resolves on both.
Environment: Linux, loopback HTTP, separate worktrees and fresh databases, GIT_CONFIG_GLOBAL=/dev/null. Images render captured server-response transcripts; they are not UI screenshots.
| Before | After |
|---|---|
| ee90bdc940 | 03edd1a95d |
![]() | ![]() |
| Text transcript | Text transcript |
Reproduction driver · Transcript renderer
AI-assisted; verified with the tests and tools listed above.
Not shown:
- Downstream display and provider-matching behavior in web, desktop and mobile was not exercised. Evidence directly demonstrates the reported repositoryIdentity failure through the real server API; the single-project sidebar title does not expose this difference.
Tests#
GIT_CONFIG_GLOBAL=/dev/null vp test run src/project/RepositoryIdentityResolver.test.ts: 1 failed (the repro test) / 12 passed on the base commit, 13/13 passed with the fix. vp run check:changed: format, lint, knip, graphql and typecheck (3 packages) pass; its test step fails 'resolves the fetch remote of a partial clone' and 'reports a fork's own remote as origin next to the upstream identity' only because of the VM's global git insteadOf rewrite (both pass with GIT_CONFIG_GLOBAL=/dev/null).
Not in this change#
- Three copies of the
git remote -vparsing (RepositoryIdentityResolver, GitVcsDriver, GitVcsDriverCore) could be merged into one shared parser, as open PR #28769 proposes; not done here.
AI-assisted; verified with the tests and tools listed above.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
03edd1aMacroscope's review found this PR approvable — Git remote URLs containing spaces can now produce repository identities through the existing resolution flow. Existing remote filtering and selection remain unchanged, keeping the correction narrowly scoped.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful
mainmeasurement shown below.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 ✅ Baseline:
b68aedf· PR result:03edd1a· Source CI: successScenario 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.
No actionable comments were generated in the recent review.
Walkthrough
-
The repository identity resolver now parses Git remote output without splitting URLs at spaces. A test checks that a spaced SSH URL is preserved and associated with the
originremote.Changes: Repository identity parsing
Layer / File(s) Summary Parse remote URLs with spaces
apps/server/src/project/RepositoryIdentityResolver.ts,apps/server/src/project/RepositoryIdentityResolver.test.tsThe parser handles LF and CRLF output and uses tab-separated remote names and URLs, preserving spaces in URLs. The test checks the resolved URL and originremote name.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
maxwellyoung,t3dotgg
Merge Risk:
Minimal · up to03edd-
Projects whose Git origin URL contains a space can now receive a repository identity based on that URL, as the linked issue requested. 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 (a project whose origin URL contains a space) and the component (server). It matches the linked issue #35034and the parser change in RepositoryIdentityResolver. The title is a…Linked Issues check [ #35034] requires a repository identity for a project whose origin URL contains a space. The diff at apps/server/src/project/RepositoryIdentityResolver.ts changes parseRemoteFetchUrls to split on /\r?…Out of Scope Changes check The whole-PR changes (merge base ee90bdc9405d, head 03edd1a95d80) touch only RepositoryIdentityResolver.ts (parser regex and line splitting) and RepositoryIdentityResolver.test.ts (one regression test… Description check The description is thorough and covers the problem (regex in parseRemoteFetchUrls fails on URLs with whitespace, leaving the project with a null repositoryIdentity), the change (tab-separated parsing … Full details: Title check
-
Explanation
The title names the fix (a project whose origin URL contains a space) and the component (server). It matches the linked issue
#35034and the parser change in RepositoryIdentityResolver. The title is a single sentence, but it is long at 83 characters. It also omits the verb 'gets' context a reader might want, but the primary change is clear.
Full details: Linked Issues check
-
Explanation
[
#35034] requires a repository identity for a project whose origin URL contains a space. The diff at apps/server/src/project/RepositoryIdentityResolver.ts changes parseRemoteFetchUrls to split on /\r?\n/ and match /^(\S+)\t(.+) ((fetch|push))(?:\s+[[^]]+])?$/. The remote name is separated from the URL by a tab, so a URL with spaces is captured in full. The optional partial-clone filter suffix is still accepted. The prior whitespace-split regex, which rejected spaced URLs, is removed. The added test in RepositoryIdentityResolver.test.ts ('resolves a remote whose URL contains a space') creates a repo with origin 'ssh://git@git.example.test/team repos/app.git' and asserts the resolved remoteUrl and remoteName 'origin'. The coding requirement is implemented. The PR description's reproduction and evidence notes are not coding requirements and were not used as proof. Remaining, non-blocking uncertainty: the test step was reported failing in two unrelated tests due to a VM global git insteadOf rewrite; this was not re-run here.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR changes (merge base ee90bdc9405d, head 03edd1a95d80) touch only RepositoryIdentityResolver.ts (parser regex and line splitting) and RepositoryIdentityResolver.test.ts (one regression test). Both changes directly implement or verify the parsing fix for [
#35034]. The PR description states that consolidating the three git remote parsers is not part of this change, and the diff does not modify GitVcsDriver or GitVcsDriverCore. No unrelated changes were found.
Full details: Description check
-
Explanation
The description is thorough and covers the problem (regex in parseRemoteFetchUrls fails on URLs with whitespace, leaving the project with a null repositoryIdentity), the change (tab-separated parsing with the same regex as GitVcsDriver and GitVcsDriverCore, splitting on \r?\n), and scope (links issue
#35034and explains why no separate issue is needed). Verification is detailed: a before/after reproduction on main and the fix, a regression test that fails on base and passes with the fix, and reported check results with the environment caveat. Template sections are present, though the Scope section does not explicitly say whether a maintainer requested the PR. The description also duplicates the 'AI-assisted' line and gives the issue link as a fix reference. These are minor, so the description is mostly complete.
-
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-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: factory/issue-35034
- File: .coderabbit.config.ts
- Commit: 03edd1a
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
f2bbbff0-517c-48d0-9004-3c4845b91ff1
Commits-
Reviewing files that changed from the base of the PR and between ee90bdc9405d8d4b8ff78ce2133ccb04844298ab and 03edd1a95d80682640f517b27f8f11936c590078.
Files selected for processing: 2-
apps/server/src/project/RepositoryIdentityResolver.test.tsapps/server/src/project/RepositoryIdentityResolver.ts
Limit details: You’ve used all 10 included reviews currently available.
-
-
juliusmarminge merged thisd6ac53e
juliusmarminge closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes