@devries-cameron20 / t3code Mirror · read-only / commits / 46002808e2
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 22:15 UTC

fix(github): find pull requests for SSH aliases (#32932)

Arun Sasidharan committed Nov 12, 2026 at 04:39 UTC 46002808e2d9873906bcdce0e6d80641b8763f61
2 files changed +29 -3
packages/source-control-github/src/server/GitHubSourceControlProvider.ts
+4 -3
@@ -308,8 +308,9 @@ export const makeDiscovery = Effect.gen(function* () {
308 refineUnknownRemote: ({ context }) => {
309 const url = URL.parse(context.provider.baseUrl);
310 if (!url?.host) return Effect.succeed(null);
311 + const host = gitHubApiHostForRemote(context.remoteUrl) ?? url.host;
312 // A timeout or keyring failure propagates: the registry does not keep that answer.
312 - return api.credential(url.host).pipe(
313 + return api.credential(host).pipe(
314 Effect.as(true),
315 Effect.catchTags({
316 GitHubCliMissingError: () => Effect.succeed(false),
@@ -320,8 +321,8 @@ export const makeDiscovery = Effect.gen(function* () {
321 known
322 ? ({
323 kind: SourceControlProviderKind.make("github"),
323 - name: "GitHub Self-Hosted",
324 - baseUrl: context.provider.baseUrl,
324 + name: host === "github.com" ? "GitHub" : "GitHub Self-Hosted",
325 + baseUrl: host === url.host ? context.provider.baseUrl : `https://${host}`,
326 } as const)
327 : null,
328 ),
packages/source-control-github/src/server/gitHubDiscovery.test.ts
+25
@@ -84,6 +84,31 @@ it.effect("asks for no credential when the identity resolver left the base URL e
84 }),
85 );
86
87 +it.effect.each([
88 + ["github-work", "git@github-work:team/project.git"],
89 + ["github-ci", "git@github-ci:team/project.git"],
90 + ["github-work", "ssh://git@github-work:22/team/project.git"],
91 + ["github.com-work", "git@github.com-work:team/project.git"],
92 +] as const)("recognizes a GitHub SSH alias on %s (%s)", ([host, remoteUrl]) =>
93 + Effect.gen(function* () {
94 + const discovery = yield* makeDiscovery((host) =>
95 + host === "github.com"
96 + ? Effect.succeed({ token: Redacted.make("token"), fingerprint: `${host}:fingerprint` })
97 + : Effect.fail(new GitHubCredentials.GitHubNotSignedInError({ host })),
98 + );
99 + if (discovery.type !== "managed-cli") return assert.fail("expected a managed CLI");
100 + const provider = yield* discovery.refineUnknownRemote({
101 + cwd: "/repo",
102 + context: { ...unknownContext(`https://${host}`), remoteUrl },
103 + });
104 + assert.deepStrictEqual(provider, {
105 + kind: SourceControlProviderKind.make("github"),
106 + name: "GitHub",
107 + baseUrl: "https://github.com",
108 + });
109 + }),
110 +);
111 +
112 const decodeSettings = Schema.decodeSync(ServerSettings);
113 const referencedTokenSettings = decodeSettings({
114 sourceControlHosts: {