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, 11:00 UTC
fix(server): name the missing project when a change request's repository has none (#37161)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Sudharsan committed
Nov 15, 2026 at 17:03 UTC
86a9d9fb71ae010ac59014e7d9d0842db16acf1d
5 files changed
+33
-5
apps/mobile/src/features/diffs/nativeReviewDiffSource.ts
+1
@@ -19,6 +19,7 @@ function permanentSourceFailureReason(error: unknown): string | undefined {
19
if (name === "GitHubDiffFileContentsUnavailableError") return "github-source-unavailable";
20
for (const permanent of [
21
"provider-unsupported",
22
+ "repository-without-project",
23
"unsupported",
24
"oversized",
25
"binary",
apps/server/src/mcp/toolkits/pullRequests/handlers.ts
+2
-1
@@ -512,7 +512,8 @@ const make = Effect.gen(function* () {
512
Effect.mapError((error) =>
513
entry.project === undefined &&
514
error._tag === "PullRequestUnavailableError" &&
515
- error.reason === "provider-unsupported"
515
+ (error.reason === "provider-unsupported" ||
516
+ error.reason === "repository-without-project")
517
? new PullRequestProjectNotFoundError({ repository: target.repository })
518
: new PullRequestGuideFailedError({
519
detail: guideFailureDetail(error),
apps/server/src/pullRequest/PullRequestService.test.ts
+12
-4
@@ -2375,7 +2375,10 @@ it.effect.each([
2375
}),
2376
);
2377
2378
-it.effect("refuses Azure cross-organization reads and writes without its checkout", () =>
2378
+it.effect.each([
2379
+ { case: "another organization", repository: "org-b/project/_git/web" },
2380
+ { case: "a sibling repository", repository: "org-a/project/_git/web-e2e" },
2381
+])("refuses Azure reads and writes in $case without its checkout", ({ repository }) =>
2382
Effect.gen(function* () {
2383
const service = yield* makeService({
2384
projects: [
@@ -2399,15 +2402,20 @@ it.effect("refuses Azure cross-organization reads and writes without its checkou
2402
const reference = {
2403
projectId: "org-a" as ProjectId,
2404
host: "dev.azure.com",
2402
- repository: "org-b/project/_git/web",
2405
+ repository,
2406
number: 7,
2407
};
2408
const readError = yield* Effect.flip(
2409
service.summary(reference, { recoverTransientFailure: false }),
2410
);
2411
const writeError = yield* Effect.flip(service.runAction({ ...reference, action: "close" }));
2409
- assert.strictEqual(readError._tag, "PullRequestUnavailableError");
2410
- assert.strictEqual(writeError._tag, "PullRequestUnavailableError");
2412
+ for (const error of [readError, writeError]) {
2413
+ expect(error).toMatchObject({
2414
+ _tag: "PullRequestUnavailableError",
2415
+ reason: "repository-without-project",
2416
+ message: `${repository} is not a project in T3 Code. Add it as a project to read its change requests.`,
2417
+ });
2418
+ }
2419
}),
2420
);
2421
apps/server/src/pullRequest/PullRequestService.ts
+13
@@ -1084,6 +1084,19 @@ export const make = Effect.gen(function* () {
1084
};
1085
}
1086
}
1087
+ const owner =
1088
+ publicHost ?? sourceControlDefinitions.findByRepositoryKey(referenceKey);
1089
+ const readable = owner === undefined ? null : registry.get(owner.kind);
1090
+ if (
1091
+ readable !== null &&
1092
+ !readable.readsPublicHostWithoutCheckout &&
1093
+ readable.servesHost?.(host) !== false
1094
+ ) {
1095
+ return yield* new PullRequestUnavailableError({
1096
+ reason: "repository-without-project",
1097
+ repository,
1098
+ });
1099
+ }
1100
return yield* new PullRequestUnavailableError({ reason: "provider-unsupported" });
1101
});
1102
}
packages/contracts/src/pullRequest.ts
+5
@@ -970,6 +970,7 @@ export const PullRequestUnavailableReason = Schema.Literals([
970
"cli-missing",
971
"cli-unauthenticated",
972
"provider-unsupported",
973
+ "repository-without-project",
974
]);
975
export type PullRequestUnavailableReason = typeof PullRequestUnavailableReason.Type;
976
@@ -999,6 +1000,8 @@ export class PullRequestUnavailableError extends Schema.TaggedError<PullRequestU
1000
* shipped no such field, and for a host that names nothing.
1001
*/
1002
requirement: Schema.optional(TrimmedNonEmptyString),
1003
+ /** The repository no project has, for `repository-without-project`. */
1004
+ repository: Schema.optional(TrimmedNonEmptyString),
1005
cause: Schema.optional(Schema.Defect()),
1006
},
1007
{ httpApiStatus: 503 },
@@ -1015,6 +1018,8 @@ export class PullRequestUnavailableError extends Schema.TaggedError<PullRequestU
1018
return this.requirement ?? "This host has no working credentials.";
1019
case "provider-unsupported":
1020
return "Change requests cannot be browsed for this project's host yet.";
1021
+ case "repository-without-project":
1022
+ return `${this.repository ?? "This repository"} is not a project in T3 Code. Add it as a project to read its change requests.`;
1023
}
1024
}
1025
}