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 22, 22:00 UTC
fix(github): read pull requests when GitHub refuses a requested reviewer (#19564)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Scott Norteman committed
Oct 20, 2026 at 01:31 UTC
ba47b1669e77fded3bd8fb217f3948b0669fb3b2
6 files changed
+363
-140
packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
+273
-94
@@ -25,6 +25,19 @@ import { KnownWorkflowRuns } from "./gitHubConditionalChecks.ts";
25
26
const encodeJson = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
27
28
+// GitHub's field-level reviewer refusal; the surrounding response data is synthetic.
29
+const refusedReviewer = {
30
+ type: "FORBIDDEN",
31
+ message: "Resource not accessible by integration",
32
+ path: ["repository", "pullRequest", "reviewRequests", "nodes", 0, "requestedReviewer"],
33
+};
34
+const pullRequestInput = { cwd: "/w", repository: "acme/web", host: "github.com", number: 7 };
35
+type PullRequestRead = (
36
+ input: typeof pullRequestInput,
37
+) => Effect.Effect<unknown, GitHubPullRequestApi.GitHubPullRequestApiError>;
38
+const refusedReviewerResponse = () =>
39
+ Effect.succeed(output(encodeJson({ ...coreResponse(), errors: [refusedReviewer] })));
40
+
41
const coreResponse = (pullRequest: Readonly<Record<string, unknown>> = {}) => ({
42
data: {
43
repository: {
@@ -338,6 +351,7 @@ function thread(id: string, ...commentIds: ReadonlyArray<string>) {
351
function reviewThreadsPage(
352
nodes: ReadonlyArray<Record<string, unknown>>,
353
endCursor: string | null,
354
+ requestedReviewers: ReadonlyArray<Record<string, unknown>> = [],
355
): string {
356
return encodeJson({
357
data: {
@@ -355,7 +369,9 @@ function reviewThreadsPage(
369
reactionGroups: [],
370
comments: { nodes: [] },
371
reviews: { nodes: [] },
358
- reviewRequests: { nodes: [] },
372
+ reviewRequests: {
373
+ nodes: requestedReviewers.map((requestedReviewer) => ({ requestedReviewer })),
374
+ },
375
latestReviews: { nodes: [] },
376
reviewDismissals: { pageInfo: lastPage, nodes: [] },
377
commits: { nodes: [] },
@@ -4137,6 +4153,164 @@ layer("GitHubPullRequestApi.layer", (it) => {
4153
}),
4154
);
4155
4156
+ it.effect.each([
4157
+ {
4158
+ name: "check path",
4159
+ errors: [
4160
+ {
4161
+ ...refusedReviewer,
4162
+ path: ["repository", "pullRequest", "commits", "nodes", 0, "commit", "statusCheckRollup"],
4163
+ },
4164
+ ],
4165
+ },
4166
+ {
4167
+ name: "mixed errors",
4168
+ errors: [refusedReviewer, { ...refusedReviewer, path: [...refusedReviewer.path, "login"] }],
4169
+ },
4170
+ {
4171
+ name: "untyped error",
4172
+ errors: [{ message: refusedReviewer.message, path: refusedReviewer.path }],
4173
+ },
4174
+ {
4175
+ name: "negative index",
4176
+ errors: [
4177
+ {
4178
+ ...refusedReviewer,
4179
+ path: ["repository", "pullRequest", "reviewRequests", "nodes", -1, "requestedReviewer"],
4180
+ },
4181
+ ],
4182
+ },
4183
+ { name: "HTTP 403", errors: [refusedReviewer], status: 403 },
4184
+ {
4185
+ name: "authentication",
4186
+ errors: [refusedReviewer],
4187
+ status: 401,
4188
+ tag: "GitHubApiAuthenticationError",
4189
+ },
4190
+ { name: "rate limit", errors: [refusedReviewer], status: 429, tag: "GitHubApiRateLimitError" },
4191
+ {
4192
+ name: "GraphQL rate limit",
4193
+ errors: [refusedReviewer, { message: "API rate limit exceeded", type: "RATE_LIMITED" }],
4194
+ tag: "GitHubApiRateLimitError",
4195
+ },
4196
+ ])("does not retry a reviewer refusal with $name", ({ name, errors, status = 200, tag }) =>
4197
+ Effect.gen(function* () {
4198
+ mockedExecute.mockReturnValue(
4199
+ Effect.succeed(
4200
+ output(
4201
+ encodeJson(status === 401 ? { message: "Bad credentials" } : { data: null, errors }),
4202
+ false,
4203
+ false,
4204
+ {},
4205
+ status,
4206
+ ),
4207
+ ),
4208
+ );
4209
+ const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4210
+ const reads: ReadonlyArray<PullRequestRead> = [
4211
+ cli.getPullRequestDetail,
4212
+ cli.listReviewThreadComments,
4213
+ ];
4214
+ for (const [index, read] of reads.entries()) {
4215
+ const error = yield* read({
4216
+ ...pullRequestInput,
4217
+ host: `github-${name.replaceAll(" ", "-")}-${index}.test`,
4218
+ }).pipe(Effect.asVoid, Effect.flip);
4219
+ expect(error._tag).toBe(tag ?? "GitHubApiResponseError");
4220
+ if (error._tag === "GitHubApiResponseError")
4221
+ expect(error).toMatchObject({ status, githubErrors: errors.map((e) => e.message) });
4222
+ expect(mockedExecute).toHaveBeenCalledTimes(index + 1);
4223
+ }
4224
+ }),
4225
+ );
4226
+
4227
+ it.effect.each(["detail", "threads"] as const)("fails a refused retry of %s", (kind) =>
4228
+ Effect.gen(function* () {
4229
+ mockedExecute.mockReturnValue(refusedReviewerResponse());
4230
+ const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4231
+ const read: PullRequestRead =
4232
+ kind === "detail" ? cli.getPullRequestDetail : cli.listReviewThreadComments;
4233
+ const error = yield* read(pullRequestInput).pipe(Effect.asVoid, Effect.flip);
4234
+ expect(error._tag).toBe("GitHubApiResponseError");
4235
+ expect(mockedExecute).toHaveBeenCalledTimes(2);
4236
+ expect(varsAt(1)["requestedReviewers"]).toBe(0);
4237
+ }),
4238
+ );
4239
+
4240
+ it.effect.each([false, true])(
4241
+ "keeps thread cursors and reviewers after a refusal (later page: %s)",
4242
+ (later) =>
4243
+ Effect.gen(function* () {
4244
+ if (later)
4245
+ mockedExecute.mockReturnValueOnce(
4246
+ Effect.succeed(
4247
+ output(
4248
+ reviewThreadsPage([thread("T1", "c1")], "next", [
4249
+ {
4250
+ __typename: "User",
4251
+ login: "prior",
4252
+ name: null,
4253
+ avatarUrl: "https://avatars/prior",
4254
+ },
4255
+ ]),
4256
+ ),
4257
+ ),
4258
+ );
4259
+ mockedExecute.mockReturnValueOnce(refusedReviewerResponse());
4260
+ mockedExecute.mockReturnValueOnce(
4261
+ Effect.succeed(output(reviewThreadsPage([thread("T2", "c2")], "last"))),
4262
+ );
4263
+ mockedExecute.mockReturnValueOnce(
4264
+ Effect.succeed(output(reviewThreadsPage([thread("T3", "c3")], null))),
4265
+ );
4266
+ const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4267
+ const read = cli.listReviewThreadComments(pullRequestInput);
4268
+ const conversation = yield* read;
4269
+ expect(
4270
+ variablesOf("ReviewThreads").map((v) => [v["after"], v["requestedReviewers"]]),
4271
+ ).toEqual(
4272
+ later
4273
+ ? [
4274
+ [null, 50],
4275
+ ["next", 50],
4276
+ ["next", 0],
4277
+ ["last", 0],
4278
+ ]
4279
+ : [
4280
+ [null, 50],
4281
+ [null, 0],
4282
+ ["last", 0],
4283
+ ],
4284
+ );
4285
+ expect(conversation.comments.map((c) => c.id)).toEqual(
4286
+ later ? ["c1", "c2", "c3"] : ["c2", "c3"],
4287
+ );
4288
+ expect(conversation.reviewers.map((r) => r.login)).toEqual(later ? ["prior"] : []);
4289
+ expect(conversation.truncated).toBe(false);
4290
+
4291
+ mockedExecute.mockReturnValueOnce(Effect.succeed(output(reviewThreadsPage([], null))));
4292
+ yield* read;
4293
+ expect(variablesOf("ReviewThreads").at(-1)).toMatchObject({
4294
+ after: null,
4295
+ requestedReviewers: 50,
4296
+ });
4297
+ }),
4298
+ );
4299
+
4300
+ it.effect("retries review threads once per read", () =>
4301
+ Effect.gen(function* () {
4302
+ mockedExecute.mockReturnValueOnce(refusedReviewerResponse());
4303
+ mockedExecute.mockReturnValueOnce(Effect.succeed(output(reviewThreadsPage([], "next"))));
4304
+ mockedExecute.mockReturnValueOnce(refusedReviewerResponse());
4305
+ const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4306
+ expect((yield* Effect.flip(cli.listReviewThreadComments(pullRequestInput)))._tag).toBe(
4307
+ "GitHubApiResponseError",
4308
+ );
4309
+ expect(mockedExecute).toHaveBeenCalledTimes(3);
4310
+ expect(varsAt(2)).toMatchObject({ after: "next", requestedReviewers: 0 });
4311
+ }),
4312
+ );
4313
+
4314
it.effect("decodes reviewers, labels and workflow checks without another detail read", () =>
4315
Effect.gen(function* () {
4316
mockedExecute.mockReturnValueOnce(
@@ -4216,111 +4390,116 @@ layer("GitHubPullRequestApi.layer", (it) => {
4390
}),
4391
);
4392
4219
- it.effect("reads every check when the combined response has another page", () =>
4220
- Effect.gen(function* () {
4221
- mockedExecute.mockReturnValueOnce(
4222
- Effect.succeed(
4223
- output(
4224
- encodeJson(
4225
- coreResponse({
4226
- commits: {
4227
- nodes: [
4228
- {
4229
- commit: {
4230
- statusCheckRollup: {
4231
- contexts: {
4232
- nodes: [
4233
- checkRun({
4234
- name: "first",
4235
- status: "COMPLETED",
4236
- conclusion: "SUCCESS",
4237
- }),
4238
- ],
4239
- pageInfo: { hasNextPage: true, endCursor: "c1" },
4393
+ it.effect.each([false, true])(
4394
+ "reads every check when the combined response has another page (reviewer refusal: %s)",
4395
+ (refused) =>
4396
+ Effect.gen(function* () {
4397
+ if (refused) mockedExecute.mockReturnValueOnce(refusedReviewerResponse());
4398
+ mockedExecute.mockReturnValueOnce(
4399
+ Effect.succeed(
4400
+ output(
4401
+ encodeJson(
4402
+ coreResponse({
4403
+ commits: {
4404
+ nodes: [
4405
+ {
4406
+ commit: {
4407
+ statusCheckRollup: {
4408
+ contexts: {
4409
+ nodes: [
4410
+ checkRun({
4411
+ name: "first",
4412
+ status: "COMPLETED",
4413
+ conclusion: "SUCCESS",
4414
+ }),
4415
+ ],
4416
+ pageInfo: { hasNextPage: true, endCursor: "c1" },
4417
+ },
4418
},
4419
},
4420
},
4243
- },
4244
- ],
4245
- },
4246
- }),
4421
+ ],
4422
+ },
4423
+ }),
4424
+ ),
4425
),
4426
),
4249
- ),
4250
- );
4251
- mockedExecute.mockReturnValueOnce(
4252
- Effect.succeed(
4253
- output(
4254
- checkContextsPage(
4255
- [
4256
- checkRun({ name: "first", status: "COMPLETED", conclusion: "SUCCESS" }),
4257
- checkRun({ name: "last", status: "COMPLETED", conclusion: "FAILURE" }),
4258
- ],
4259
- null,
4427
+ );
4428
+ mockedExecute.mockReturnValueOnce(
4429
+ Effect.succeed(
4430
+ output(
4431
+ checkContextsPage(
4432
+ [
4433
+ checkRun({ name: "first", status: "COMPLETED", conclusion: "SUCCESS" }),
4434
+ checkRun({ name: "last", status: "COMPLETED", conclusion: "FAILURE" }),
4435
+ ],
4436
+ null,
4437
+ ),
4438
),
4439
),
4262
- ),
4263
- );
4264
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4265
- const detail = yield* cli.getPullRequestDetail({
4266
- cwd: "/w",
4267
- repository: "acme/web",
4268
- host: "github.com",
4269
- number: 7,
4270
- });
4271
- expect(detail.checks).toHaveLength(2);
4272
- expect(detail.checksState).toBe("failing");
4273
- expect(detail.checksTruncated).toBe(false);
4274
- // The whole rollup is walked from its start, so no check is counted twice or skipped.
4275
- expect(varsAt(1)).toMatchObject({ number: 7 });
4276
- expect(varsAt(1)).not.toHaveProperty("after");
4277
- assert.strictEqual(mockedExecute.mock.calls.length, 2);
4278
- }),
4440
+ );
4441
+ const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4442
+ const read = cli.getPullRequestDetail(pullRequestInput);
4443
+ const detail = yield* read;
4444
+ expect(detail.reviewRequestLogins).toEqual([]);
4445
+ expect(detail.reviewRequestTeams).toEqual([]);
4446
+ expect(detail.hasTeamReviewRequest).toBe(false);
4447
+ if (refused)
4448
+ expect(variablesOf("PullRequestCore").map((v) => v["requestedReviewers"])).toEqual([
4449
+ 100, 0,
4450
+ ]);
4451
+ expect(detail.checks).toHaveLength(2);
4452
+ expect(detail.checksState).toBe("failing");
4453
+ expect(detail.checksTruncated).toBe(false);
4454
+ // The whole rollup is walked from its start, so no check is counted twice or skipped.
4455
+ expect(variablesOf("CheckContexts")).toEqual([expect.objectContaining({ number: 7 })]);
4456
+ expect(variablesOf("CheckContexts")[0]).not.toHaveProperty("after");
4457
+ expect(mockedExecute).toHaveBeenCalledTimes(refused ? 3 : 2);
4458
+
4459
+ if (refused) {
4460
+ mockedExecute.mockReturnValueOnce(Effect.succeed(output(encodeJson(coreResponse()))));
4461
+ yield* read;
4462
+ expect(variablesOf("PullRequestCore").at(-1)).toMatchObject({ requestedReviewers: 100 });
4463
+ }
4464
+ }),
4465
);
4466
4281
- it.effect("refuses to combine checks from different head revisions", () =>
4282
- Effect.gen(function* () {
4283
- const response = coreResponse({
4284
- commits: {
4285
- nodes: [
4286
- {
4287
- commit: {
4288
- statusCheckRollup: {
4289
- contexts: {
4290
- nodes: [],
4291
- pageInfo: { hasNextPage: true },
4467
+ it.effect.each([false, true])(
4468
+ "refuses to combine checks from different head revisions (reviewer refusal: %s)",
4469
+ (refused) =>
4470
+ Effect.gen(function* () {
4471
+ if (refused) mockedExecute.mockReturnValueOnce(refusedReviewerResponse());
4472
+ const response = coreResponse({
4473
+ commits: {
4474
+ nodes: [
4475
+ {
4476
+ commit: {
4477
+ statusCheckRollup: {
4478
+ contexts: {
4479
+ nodes: [],
4480
+ pageInfo: { hasNextPage: true },
4481
+ },
4482
},
4483
},
4484
},
4295
- },
4296
- ],
4297
- },
4298
- });
4299
- mockedExecute.mockReturnValueOnce(Effect.succeed(output(encodeJson(response))));
4300
- mockedExecute.mockReturnValueOnce(
4301
- Effect.succeed(
4302
- output(
4303
- encodeJson({
4304
- ...response.data.repository.pullRequest,
4305
- headRefOid: "new-head",
4306
- reviewRequests: [],
4307
- labels: [],
4308
- statusCheckRollup: [],
4309
- }),
4310
- ),
4311
- ),
4312
- );
4313
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4314
- const error = yield* Effect.flip(
4315
- cli.getPullRequestDetail({
4316
- cwd: "/w",
4317
- repository: "acme/web",
4318
- host: "github.com",
4319
- number: 7,
4320
- }),
4321
- );
4322
- expect(error._tag).toBe("GitHubPullRequestReadError");
4323
- }),
4485
+ ],
4486
+ },
4487
+ });
4488
+ mockedExecute.mockReturnValueOnce(Effect.succeed(output(encodeJson(response))));
4489
+ mockedExecute.mockReturnValueOnce(
4490
+ Effect.succeed(output(checkContextsPage([], null, "new-head"))),
4491
+ );
4492
+ const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4493
+ const error = yield* Effect.flip(
4494
+ cli.getPullRequestDetail({
4495
+ cwd: "/w",
4496
+ repository: "acme/web",
4497
+ host: "github.com",
4498
+ number: 7,
4499
+ }),
4500
+ );
4501
+ expect(error._tag).toBe("GitHubPullRequestReadError");
4502
+ }),
4503
);
4504
4505
it.effect("preserves the reserve for automatic detail reads and allows manual checks", () =>
packages/source-control-github/src/server/GitHubPullRequestApi.ts
+70
-37
@@ -319,6 +319,24 @@ const isGraphQlClientError = (error: unknown): error is GraphQLClientError.Graph
319
320
const { isNotFoundOnly } = GitHubGraphQlClient;
321
322
+const isRefusedRequestedReviewersOnly = (error: unknown): boolean =>
323
+ isGraphQlClientError(error) &&
324
+ error.reason._tag === "ResponseError" &&
325
+ error.reason.status === 200 &&
326
+ error.reason.errors.every(
327
+ ({ path, type }) =>
328
+ type === "FORBIDDEN" &&
329
+ path?.length === 6 &&
330
+ path[0] === "repository" &&
331
+ path[1] === "pullRequest" &&
332
+ path[2] === "reviewRequests" &&
333
+ path[3] === "nodes" &&
334
+ typeof path[4] === "number" &&
335
+ Number.isInteger(path[4]) &&
336
+ path[4] >= 0 &&
337
+ path[5] === "requestedReviewer",
338
+ );
339
+
340
/** A large pull request can produce a multi-megabyte patch; past this it is truncated. */
341
const DIFF_MAX_OUTPUT_BYTES = 8 * 1024 * 1024;
342
const DIFF_TIMEOUT = Duration.seconds(60);
@@ -1384,43 +1402,45 @@ export const make = Effect.gen(function* () {
1402
const getPullRequestDetail: GitHubPullRequestApi["Service"]["getPullRequestDetail"] = (input) => {
1403
const { owner, name } = parseRepositorySelector(input.repository);
1404
const operation = "getPullRequestDetail";
1405
+ const read = (requestedReviewers: number) =>
1406
+ client.PullRequestCore({
1407
+ owner,
1408
+ name,
1409
+ number: input.number,
1410
+ headRef: `refs/pull/${input.number}/head`,
1411
+ required: asksRequired(input.host),
1412
+ requestedReviewers,
1413
+ });
1414
return SourceControlRateLimit.Interactive.pipe(
1415
Effect.flatMap((allowReserve) =>
1389
- client
1390
- .PullRequestCore({
1391
- owner,
1392
- name,
1393
- number: input.number,
1394
- headRef: `refs/pull/${input.number}/head`,
1395
- required: asksRequired(input.host),
1396
- })
1397
- .pipe(
1398
- graphql({ ...input, operation, allowReserve }),
1399
- Effect.map(toPullRequestCore),
1400
- Effect.flatMap(found({ ...input, operation })),
1401
- // Past a hundred checks the first page would let the rest imply success, so the whole
1402
- // rollup is walked instead.
1403
- Effect.filterOrElse(
1404
- (core) => !core.checksTruncated,
1405
- (core) =>
1406
- readAllCheckContexts(input, allowReserve).pipe(
1407
- Effect.filterOrFail(
1408
- (all) => all.headSha === core.headSha,
1409
- () =>
1410
- readError(
1411
- input.cwd,
1412
- operation,
1413
- new Error("Pull request head changed while reading checks."),
1414
- ),
1415
- ),
1416
- Effect.map((all) => ({
1417
- ...core,
1418
- ...pullRequestChecksFromContexts(all.contexts),
1419
- checksTruncated: all.truncated,
1420
- })),
1416
+ read(100).pipe(
1417
+ Effect.catchIf(isRefusedRequestedReviewersOnly, () => read(0)),
1418
+ graphql({ ...input, operation, allowReserve }),
1419
+ Effect.map(toPullRequestCore),
1420
+ Effect.flatMap(found({ ...input, operation })),
1421
+ // Past a hundred checks the first page would let the rest imply success, so the whole
1422
+ // rollup is walked instead.
1423
+ Effect.filterOrElse(
1424
+ (core) => !core.checksTruncated,
1425
+ (core) =>
1426
+ readAllCheckContexts(input, allowReserve).pipe(
1427
+ Effect.filterOrFail(
1428
+ (all) => all.headSha === core.headSha,
1429
+ () =>
1430
+ readError(
1431
+ input.cwd,
1432
+ operation,
1433
+ new Error("Pull request head changed while reading checks."),
1434
+ ),
1435
),
1422
- ),
1436
+ Effect.map((all) => ({
1437
+ ...core,
1438
+ ...pullRequestChecksFromContexts(all.contexts),
1439
+ checksTruncated: all.truncated,
1440
+ })),
1441
+ ),
1442
),
1443
+ ),
1444
),
1445
);
1446
};
@@ -2113,12 +2133,25 @@ export const make = Effect.gen(function* () {
2133
function* (input) {
2134
const { owner, name } = parseRepositorySelector(input.repository);
2135
const target = { ...input, operation: "listReviewThreadComments" };
2136
+ let requestedReviewers = 50;
2137
const threadPage = (
2138
after: string | null,
2118
- ): Effect.Effect<GitHubReviewThreadPage, GitHubPullRequestApiError> =>
2119
- client
2120
- .ReviewThreads({ owner, name, number: input.number, after })
2121
- .pipe(graphql(target), Effect.map(toReviewThreadPage), Effect.flatMap(found(target)));
2139
+ ): Effect.Effect<GitHubReviewThreadPage, GitHubPullRequestApiError> => {
2140
+ const read = () =>
2141
+ client.ReviewThreads({ owner, name, number: input.number, after, requestedReviewers });
2142
+ return read().pipe(
2143
+ Effect.catchIf(
2144
+ (error) => requestedReviewers > 0 && isRefusedRequestedReviewersOnly(error),
2145
+ () => {
2146
+ requestedReviewers = 0;
2147
+ return read();
2148
+ },
2149
+ ),
2150
+ graphql(target),
2151
+ Effect.map(toReviewThreadPage),
2152
+ Effect.flatMap(found(target)),
2153
+ );
2154
+ };
2155
const entries: GitHubReviewThreadEntry[] = [];
2156
const avatarsByLogin = new Map<string, string>();
2157
const botLogins = new Set<string>();
packages/source-control-github/src/server/pullRequestReads.graphql
+2
-1
@@ -51,6 +51,7 @@ query PullRequestCore(
51
$number: Int!
52
$headRef: String!
53
$required: Boolean!
54
+ $requestedReviewers: Int!
55
) {
56
repository(owner: $owner, name: $name) {
57
mergeCommitAllowed
@@ -110,7 +111,7 @@ query PullRequestCore(
111
behindBy
112
}
113
}
113
- reviewRequests(first: 100) {
114
+ reviewRequests(first: $requestedReviewers) {
115
nodes {
116
requestedReviewer {
117
... on User {
packages/source-control-github/src/server/pullRequestReads.graphql.ts
+5
-3
@@ -425,10 +425,11 @@ export const PullRequestCore = GraphQL.query("PullRequestCore", {
425
{ name: "name", body: "String!" },
426
{ name: "number", body: "Int!" },
427
{ name: "headRef", body: "String!" },
428
- { name: "required", body: "Boolean!" }
428
+ { name: "required", body: "Boolean!" },
429
+ { name: "requestedReviewers", body: "Int!" }
430
],
431
selections: [
431
- { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){mergeCommitAllowed squashMergeAllowed rebaseMergeAllowed autoMergeAllowed viewerPermission pullRequest(number:$", "number", "){number title url body state isDraft mergeable mergeStateStatus reviewDecision additions deletions changedFiles createdAt updatedAt mergedAt closedAt headRefName baseRefName headRefOid isCrossRepository headRepositoryOwner{__typename login}headRepository{nameWithOwner viewerPermission}headRef{id}author{__typename login avatarUrl...on User{id name}}autoMergeRequest{mergeMethod}viewerCanUpdate viewerDidAuthor viewerCanUpdateBranch baseRef{compare(headRef:$", "headRef", "){behindBy}}reviewRequests(first:100){nodes{requestedReviewer{__typename...on User{login name}...on Bot{login}...on Team{slug combinedSlug teamName:name teamAvatarUrl:avatarUrl}}}}labels(first:100){nodes{name color}}commits(last:1){nodes{commit{statusCheckRollup{contexts(first:100){nodes{__typename...", "CheckContext", "}pageInfo{hasNextPage}}}}}}}}"] }
432
+ { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){mergeCommitAllowed squashMergeAllowed rebaseMergeAllowed autoMergeAllowed viewerPermission pullRequest(number:$", "number", "){number title url body state isDraft mergeable mergeStateStatus reviewDecision additions deletions changedFiles createdAt updatedAt mergedAt closedAt headRefName baseRefName headRefOid isCrossRepository headRepositoryOwner{__typename login}headRepository{nameWithOwner viewerPermission}headRef{id}author{__typename login avatarUrl...on User{id name}}autoMergeRequest{mergeMethod}viewerCanUpdate viewerDidAuthor viewerCanUpdateBranch baseRef{compare(headRef:$", "headRef", "){behindBy}}reviewRequests(first:$", "requestedReviewers", "){nodes{requestedReviewer{__typename...on User{login name}...on Bot{login}...on Team{slug combinedSlug teamName:name teamAvatarUrl:avatarUrl}}}}labels(first:100){nodes{name color}}commits(last:1){nodes{commit{statusCheckRollup{contexts(first:100){nodes{__typename...", "CheckContext", "}pageInfo{hasNextPage}}}}}}}}"] }
433
],
434
fragments: [
435
{ name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{workflow{name}}}}}"] }
@@ -439,7 +440,8 @@ export const PullRequestCore = GraphQL.query("PullRequestCore", {
440
name: Schema.String,
441
number: Shared.Int,
442
headRef: Schema.String,
442
- required: Schema.Boolean
443
+ required: Schema.Boolean,
444
+ requestedReviewers: Shared.Int
445
},
446
result: Schema.Struct({
447
/** Lookup a given repository by the owner and repository name. */
packages/source-control-github/src/server/pullRequestReviews.graphql
+8
-2
@@ -53,7 +53,13 @@ fragment ThreadComment on PullRequestReviewComment {
53
#
54
# `viewerCanUpdate` and `viewerDidAuthor` belong to the pull request this query is already
55
# standing on, so what the reader may do with it arrives with the conversation.
56
-query ReviewThreads($owner: String!, $name: String!, $number: Int!, $after: String) {
56
+query ReviewThreads(
57
+ $owner: String!
58
+ $name: String!
59
+ $number: Int!
60
+ $after: String
61
+ $requestedReviewers: Int!
62
+) {
63
viewer {
64
login
65
}
@@ -121,7 +127,7 @@ query ReviewThreads($owner: String!, $name: String!, $number: Int!, $after: Stri
127
...Reactions
128
}
129
}
124
- reviewRequests(first: 50) {
130
+ reviewRequests(first: $requestedReviewers) {
131
nodes {
132
# Null for nobody. A team goes by its `org/slug`; a mannequin answers with neither and
133
# names nobody to show. A team's name and avatar are aliased apart from a person's,
packages/source-control-github/src/server/pullRequestReviews.graphql.ts
+5
-3
@@ -421,11 +421,12 @@ export const ReviewThreads = GraphQL.query("ReviewThreads", {
421
{ name: "owner", body: "String!" },
422
{ name: "name", body: "String!" },
423
{ name: "number", body: "Int!" },
424
- { name: "after", body: "String" }
424
+ { name: "after", body: "String" },
425
+ { name: "requestedReviewers", body: "Int!" }
426
],
427
selections: [
428
{ name: "viewer", body: ["{login}"] },
428
- { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){reviewThreads(first:100 after:$", "after", "){totalCount pageInfo{hasNextPage endCursor}nodes{id isResolved isOutdated path line diffSide comments(first:10){totalCount pageInfo{hasNextPage endCursor}nodes{...ThreadComment}}}}viewerCanUpdate viewerDidAuthor author{__typename login avatarUrl}...Reactions comments(first:100){nodes{id lastEditedAt author{__typename login avatarUrl}...Reactions}}reviews(first:100){nodes{id lastEditedAt author{__typename login avatarUrl}...Reactions}}reviewRequests(first:50){nodes{requestedReviewer{__typename...on User{login name avatarUrl}...on Bot{login avatarUrl}...on Team{combinedSlug teamName:name teamAvatarUrl:avatarUrl}}}}latestReviews(first:50){nodes{state author{__typename login avatarUrl}}}reviewDismissals:timelineItems(itemTypes:[REVIEW_DISMISSED_EVENT]first:100){pageInfo{hasNextPage endCursor}nodes{__typename...on ReviewDismissedEvent{dismissalMessage review{id}}}}commits(last:100){nodes{commit{oid messageHeadline committedDate additions deletions parents(first:1){totalCount}authors(first:3){nodes{name avatarUrl user{login}}}}}}}}"] }
429
+ { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){reviewThreads(first:100 after:$", "after", "){totalCount pageInfo{hasNextPage endCursor}nodes{id isResolved isOutdated path line diffSide comments(first:10){totalCount pageInfo{hasNextPage endCursor}nodes{...ThreadComment}}}}viewerCanUpdate viewerDidAuthor author{__typename login avatarUrl}...Reactions comments(first:100){nodes{id lastEditedAt author{__typename login avatarUrl}...Reactions}}reviews(first:100){nodes{id lastEditedAt author{__typename login avatarUrl}...Reactions}}reviewRequests(first:$", "requestedReviewers", "){nodes{requestedReviewer{__typename...on User{login name avatarUrl}...on Bot{login avatarUrl}...on Team{combinedSlug teamName:name teamAvatarUrl:avatarUrl}}}}latestReviews(first:50){nodes{state author{__typename login avatarUrl}}}reviewDismissals:timelineItems(itemTypes:[REVIEW_DISMISSED_EVENT]first:100){pageInfo{hasNextPage endCursor}nodes{__typename...on ReviewDismissedEvent{dismissalMessage review{id}}}}commits(last:100){nodes{commit{oid messageHeadline committedDate additions deletions parents(first:1){totalCount}authors(first:3){nodes{name avatarUrl user{login}}}}}}}}"] }
430
],
431
fragments: [
432
{ name: "ThreadComment", body: ["on PullRequestReviewComment{id author{__typename login avatarUrl}body createdAt lastEditedAt url...Reactions}"] },
@@ -436,7 +437,8 @@ export const ReviewThreads = GraphQL.query("ReviewThreads", {
437
owner: Schema.String,
438
name: Schema.String,
439
number: Shared.Int,
439
- after: Schema.optional(Schema.NullOr(Schema.String))
440
+ after: Schema.optional(Schema.NullOr(Schema.String)),
441
+ requestedReviewers: Shared.Int
442
},
443
result: Schema.Struct({
444
/** The currently authenticated user. */