Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(source-control): SCP-style remotes with a leading slash keep their repository path #44007

Mergedonly21mil(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/44007/headmerged by juliusmarminge View on GitHub

Problem

When an SCP-style remote has a slash after the colon (git@github.com:/T3Tools/T3Code.git, github.com:/T3Tools/T3Code.git), repositoryPathFromRemoteUrl returns null instead of T3Tools/T3Code. Git and the sibling parsers (parseGitRemoteRepository, userlessScpRemoteHost, parseGitRemoteHost) accept that slash.

Change

The regex in packages/source-control-core/src/server/SourceControlProvider.ts allows \/? after : in both SCP branches and drops : from the user part ([^@/:\s]+@), so backup:git@forge:/Owner/Repo.git still reads as Git reads it and helper URLs like hg::user@host:Owner/Repo.git return null, as userlessScpRemoteHost and parseGitRemoteHost do. New it.each rows: three leading-slash cases, those two, and a file:/// guard.

Scope

Bug fix for wrong data: repository identity loses owner/name casing. AgentSessionScanner and GitManager's owner/name parse also get null (by code reading, not run). No issue; a one-line regex bug needs none.

Refs #31917 (same regex line, IPv6 hosts only).

Verification

Setup: Linux, Node 26.13.1, real t3 serve from source, fresh data dir and repos per commit, no accounts or network.

Steps: Init repos with remotes git@github.com:/T3Tools/T3Code.git and git@github.com:T3Tools/T3Code.git → t3 project add each → GET /api/projects → print each repositoryIdentity (jq sorts rows, so order varies).

Before (bddcfb717c57):

{
  "remote": "git@github.com:T3Tools/T3Code.git",
  "displayName": "T3Tools/T3Code",
  "owner": "T3Tools",
  "name": "T3Code"
}
{
  "remote": "git@github.com:/T3Tools/T3Code.git",
  "displayName": "t3tools/t3code",
  "owner": "t3tools",
  "name": "t3code"
}

After (0aae673cf1b4):

{
  "remote": "git@github.com:/T3Tools/T3Code.git",
  "displayName": "T3Tools/T3Code",
  "owner": "T3Tools",
  "name": "T3Code"
}
{
  "remote": "git@github.com:T3Tools/T3Code.git",
  "displayName": "T3Tools/T3Code",
  "owner": "T3Tools",
  "name": "T3Code"
}

The same steps on newest green main (ec2777c370f1) show the bug; a clean local merge shows the fix and passes the focused tests. On the base source the leading-slash and hg:: rows fail; all rows pass on head. vp run check:changed passed. An AI agent ran these checks.

Not shown

  • No UI capture (web project label not driven; server-only proof).
  • Windows/macOS not run (pure string parsing).
  • GitManager and AgentSessionScanner not run on the real server.
Test output

Base (bddcfb717c57 source with the new table, fails):

 FAIL  |root| packages/source-control-core/src/server/SourceControlProvider.test.ts > reads the repository path of git@github.com:/T3Tools/t3code.git
 FAIL  |root| packages/source-control-core/src/server/SourceControlProvider.test.ts > reads the repository path of github.com:/T3Tools/t3code.git
AssertionError: expected null to equal 'T3Tools/t3code'
 FAIL  |root| packages/source-control-core/src/server/SourceControlProvider.test.ts > reads the repository path of gitlab.com:/T3Tools/platform/t3code
AssertionError: expected null to equal 'T3Tools/platform/t3code'
 FAIL  |root| packages/source-control-core/src/server/SourceControlProvider.test.ts > reads the repository path of hg::user@host:Owner/Repo.git
AssertionError: expected 'Owner/Repo' to equal null
      Tests  4 failed | 10 passed (14)

Head (0aae673cf1b4, passes):

      Tests  14 passed (14)

Generated with Gemini 4 Neon in T3 Code Nightly

    1. Pushed8925124

    2. Evidence

      Create three empty Git repositories with leading-slash, no-slash, and helper origins. On each commit, start the real Linux server with a fresh database and T3CODE_DEV_SEED=0, run t3 project add for all three, fetch /api/projects, and call agentSessions.scan using synthetic session metadata.

      BeforeAfter
      3c72b4e781892512410a
      Before: captured runtime transcript for all three originsAfter: captured runtime transcript for all three origins
      Leading slash loses casing; scanned path is null. Helper incorrectly yields Owner/Repo.Leading slash preserves T3Tools/T3Code; helper yields null.

      Images render actual server/CLI response transcripts, not UI screenshots. The no-slash control remains correct on both commits.

      Driver · Transcript renderer · Before JSON · After JSON

      Response captures, with fixture paths redacted: Before projects, After projects, Before discovery, After discovery.

    3. juliusmarminge added labelstakeover:ready

    4. juliusmarminge removed labelstakeover:in-progress

    5. juliusmarminge merged this3436f5f

    6. juliusmarminge closed this

    7. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.