The best way to control Claude Code, Codex and more from any computer or phone
fix(forgejo): review guides work for checkouts whose SSH remote is not the web host (#29784)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 14, 2026 at 20:42 UTC
c6a120a958c8b8f768375b8fae536fa6c0582914
3 files changed
+13
-4
packages/source-control-core/src/shared/definition.ts
+1
@@ -73,6 +73,7 @@ export type ChangeRequestHostIdentity =
73
| {
74
readonly canonicalKey?: string | undefined;
75
readonly locator?: { readonly remoteUrl: string } | undefined;
76
+ readonly webUrl?: string | undefined;
77
}
78
| null
79
| undefined;
packages/source-control-forgejo/src/shared/definition.test.ts
+7
@@ -169,5 +169,12 @@ describe("Forgejo change request host", () => {
169
expect(
170
definition.changeRequestHost?.(identity("ssh://git@forge.example:2222/git/team/repo.git")),
171
).toBe("forge.example");
172
+ expect(
173
+ definition.changeRequestHost?.(
174
+ identity("ssh://git@ssh.forge.example:2222/git/team/repo.git", {
175
+ webUrl: "http://forge.example:3000/git/team/repo",
176
+ }),
177
+ ),
178
+ ).toBe("forge.example:3000");
179
});
180
});
packages/source-control-forgejo/src/shared/definition.ts
+5
-4
@@ -4,7 +4,6 @@ import {
4
buildCommitUrl,
5
changeRequestUrlBelow,
6
type ChangeRequestHostIdentity,
7
- type ChangeRequestProjectIdentity,
7
defineSourceControl,
8
isChangeRequestAuthorityOfProject,
9
isChangeRequestInProjectRepository,
@@ -34,8 +33,8 @@ const changeRequestHeadRef = (number: number) => `refs/pull/${number}/head`;
33
* The repository's browser URL the server resolved from the signed-in account, which is the
34
* only place a Forgejo mounted below a path says so.
35
*/
37
-function resolvedWebUrl(identity: ChangeRequestProjectIdentity): URL | null {
38
- if (!identity.webUrl) return null;
36
+function resolvedWebUrl(identity: ChangeRequestHostIdentity): URL | null {
37
+ if (!identity?.webUrl) return null;
38
try {
39
const url = new URL(identity.webUrl);
40
return url.protocol === "http:" || url.protocol === "https:" ? url : null;
@@ -44,8 +43,10 @@ function resolvedWebUrl(identity: ChangeRequestProjectIdentity): URL | null {
43
}
44
}
45
47
-/** A server's identity includes its port, which only an HTTP remote names. */
46
+/** A server's identity includes its port, which only its web URL or an HTTP remote names. */
47
function changeRequestHost(identity: ChangeRequestHostIdentity): string {
48
+ const web = resolvedWebUrl(identity);
49
+ if (web) return web.host.toLowerCase();
50
try {
51
const remote = new URL(identity?.locator?.remoteUrl ?? "");
52
if (remote.protocol === "http:" || remote.protocol === "https:") {