The best way to control Claude Code, Codex and more from any computer or phone
fix(server): stop grouping unrelated repos that only have a local git remote (#13129)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Adam Buchweitz committed
Oct 18, 2026 at 14:17 UTC
19f3f6d9fbf914a6e6b61c2dbc5d5babdffcc1ec
2 files changed
+45
-1
apps/server/src/project/RepositoryIdentityResolver.test.ts
+27
@@ -251,6 +251,33 @@ it.layer(NodeServices.layer)("RepositoryIdentityResolverLive", (it) => {
251
}).pipe(Effect.provide(RepositoryIdentityResolver.layer)),
252
);
253
254
+ it.effect("ignores local-path remotes such as GitButler's gb-local", () =>
255
+ Effect.gen(function* () {
256
+ const fileSystem = yield* FileSystem.FileSystem;
257
+ const localOnlyDir = yield* fileSystem.makeTempDirectoryScoped({
258
+ prefix: "t3-repository-identity-local-remote-",
259
+ });
260
+ const mixedDir = yield* fileSystem.makeTempDirectoryScoped({
261
+ prefix: "t3-repository-identity-mixed-remote-",
262
+ });
263
+
264
+ yield* git(localOnlyDir, ["init"]);
265
+ yield* git(localOnlyDir, ["remote", "add", "gb-local", "."]);
266
+ yield* git(localOnlyDir, ["remote", "add", "backup", "/srv/git/repo.git"]);
267
+ yield* git(localOnlyDir, ["remote", "add", "archive", "file:///srv/git/repo.git"]);
268
+ yield* git(mixedDir, ["init"]);
269
+ yield* git(mixedDir, ["remote", "add", "gb-local", "."]);
270
+ yield* git(mixedDir, ["remote", "add", "mirror", "git@github.com:T3Tools/t3code.git"]);
271
+
272
+ const resolver = yield* RepositoryIdentityResolver.RepositoryIdentityResolver;
273
+ expect(yield* resolver.resolve(localOnlyDir)).toBeNull();
274
+
275
+ const mixedIdentity = yield* resolver.resolve(mixedDir);
276
+ expect(mixedIdentity?.locator.remoteName).toBe("mirror");
277
+ expect(mixedIdentity?.canonicalKey).toBe("github.com/t3tools/t3code");
278
+ }).pipe(Effect.provide(RepositoryIdentityResolver.layer)),
279
+ );
280
+
281
it.effect.each(["add", "replace"] as const)(
282
"refreshes the primary upstream after %s before cache expiry",
283
(change) =>
apps/server/src/project/RepositoryIdentityResolver.ts
+18
-1
@@ -41,6 +41,18 @@ export class RepositoryIdentityResolver extends Context.Service<
41
}
42
>()("t3/project/RepositoryIdentityResolver") {}
43
44
+// Local remotes (GitButler's `gb-local` is `.`) name a path on this machine,
45
+// not a repository, so unrelated repos would share one identity.
46
+function isLocalRemoteUrl(url: string): boolean {
47
+ if (/^file:/i.test(url)) return true;
48
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(url)) return false;
49
+ if (/^[a-z]:[\\/]/i.test(url)) return true;
50
+ // Git treats `host:path` as scp-style only when the colon precedes any slash.
51
+ const colonIndex = url.indexOf(":");
52
+ const slashIndex = url.search(/[\\/]/);
53
+ return colonIndex === -1 || (slashIndex !== -1 && slashIndex < colonIndex);
54
+}
55
+
56
function parseRemoteFetchUrls(stdout: string): Map<string, string> {
57
const remotes = new Map<string, string>();
58
for (const line of stdout.split("\n")) {
@@ -49,7 +61,12 @@ function parseRemoteFetchUrls(stdout: string): Map<string, string> {
61
const match = /^(\S+)\s+(\S+)\s+\((fetch|push)\)$/.exec(trimmed);
62
if (!match) continue;
63
const [, remoteName = "", remoteUrl = "", direction = ""] = match;
52
- if (direction !== "fetch" || remoteName.length === 0 || remoteUrl.length === 0) {
64
+ if (
65
+ direction !== "fetch" ||
66
+ remoteName.length === 0 ||
67
+ remoteUrl.length === 0 ||
68
+ isLocalRemoteUrl(remoteUrl)
69
+ ) {
70
continue;
71
}
72
remotes.set(remoteName, remoteUrl);