@devries-cameron20 / t3code Mirror · read-only / commits / d427894aa1
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, 09:45 UTC

fix(server): GitLab reads with no project on the host name the host, not the repository (#37638)

Julius Marminge committed Nov 16, 2026 at 05:19 UTC d427894aa1d170ce0222fe005723f5e91419916b
3 files changed +42 -4
apps/server/src/pullRequest/PullRequestService.test.ts
+28
@@ -2419,6 +2419,34 @@ it.effect.each([
2419 }),
2420 );
2421
2422 +// regression: #37633 any checkout on the host routes the read, so name the host, not the repository
2423 +it.effect("names the host when no project has a checkout on it for a host-routed read", () =>
2424 + Effect.gen(function* () {
2425 + const service = yield* makeService({
2426 + projects: [project({ id: "wrapper", title: "Wrapper", workspaceRoot: "/work" })],
2427 + providers: [
2428 + fakePullRequestProvider(SourceControlProviderKind.make("gitlab"), {
2429 + getChangeRequestSummary: () => Effect.die("no checkout to read through"),
2430 + }),
2431 + ],
2432 + });
2433 + const error = yield* Effect.flip(
2434 + service.summary(
2435 + {
2436 + projectId: "wrapper" as ProjectId,
2437 + host: "gitlab.com",
2438 + repository: "acme/web",
2439 + number: 7,
2440 + },
2441 + { recoverTransientFailure: false },
2442 + ),
2443 + );
2444 + assert.strictEqual(error._tag, "PullRequestUnavailableError");
2445 + expect(error.message).not.toContain("acme/web is not a project");
2446 + expect(error.message).toContain("gitlab.com");
2447 + }),
2448 +);
2449 +
2450 it.effect("prefers a matching checkout over a non-repository project's directory", () =>
2451 Effect.gen(function* () {
2452 const seen: string[] = [];
apps/server/src/pullRequest/PullRequestService.ts
+6 -4
@@ -1092,10 +1092,12 @@ export const make = Effect.gen(function* () {
1092 !readable.readsPublicHostWithoutCheckout &&
1093 readable.servesHost?.(host) !== false
1094 ) {
1095 - return yield* new PullRequestUnavailableError({
1096 - reason: "repository-without-project",
1097 - repository,
1098 - });
1095 + // Without repository keys, any checkout on the host routes the read.
1096 + return yield* new PullRequestUnavailableError(
1097 + readable.repositoryKey === undefined
1098 + ? { reason: "repository-without-project", host }
1099 + : { reason: "repository-without-project", repository },
1100 + );
1101 }
1102 return yield* new PullRequestUnavailableError({ reason: "provider-unsupported" });
1103 });
packages/contracts/src/pullRequest.ts
+8
@@ -1002,6 +1002,11 @@ export class PullRequestUnavailableError extends Schema.TaggedError<PullRequestU
1002 requirement: Schema.optional(TrimmedNonEmptyString),
1003 /** The repository no project has, for `repository-without-project`. */
1004 repository: Schema.optional(TrimmedNonEmptyString),
1005 + /**
1006 + * For `repository-without-project` on a host read through any checkout on it: the host no
1007 + * project is on.
1008 + */
1009 + host: Schema.optional(TrimmedNonEmptyString),
1010 cause: Schema.optional(Schema.Defect()),
1011 },
1012 { httpApiStatus: 503 },
@@ -1019,6 +1024,9 @@ export class PullRequestUnavailableError extends Schema.TaggedError<PullRequestU
1024 case "provider-unsupported":
1025 return "Change requests cannot be browsed for this project's host yet.";
1026 case "repository-without-project":
1027 + if (this.host !== undefined) {
1028 + return `No project in T3 Code is on ${this.host}. Add any ${this.host} project to read its change requests.`;
1029 + }
1030 return `${this.repository ?? "This repository"} is not a project in T3 Code. Add it as a project to read its change requests.`;
1031 }
1032 }