From 6f96458e2d044eeb54881fb7bbae2656c812b222 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Mon, 15 Dec 2025 21:42:43 -0800 Subject: [PATCH] Fix graphql query --- entry | 8 ++++---- mcp/reviewComments.ts | 16 +++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/entry b/entry index 977ed0b..c75ff6e 100755 --- a/entry +++ b/entry @@ -124854,6 +124854,8 @@ query ($owner: String!, $repo: String!, $pullNumber: Int!) { pullRequest(number: $pullNumber) { reviewThreads(first: 100) { nodes { + diffSide + startDiffSide comments(first: 100) { nodes { id @@ -124862,8 +124864,6 @@ query ($owner: String!, $repo: String!, $pullNumber: Int!) { path line startLine - diffSide - startSide url author { login @@ -124934,8 +124934,8 @@ var GetReviewCommentsTool = tool({ path: comment.path, line: comment.line, start_line: comment.startLine, - side: comment.diffSide, - start_side: comment.startSide, + side: thread.diffSide, + start_side: thread.startDiffSide, user: comment.author?.login ?? null, created_at: comment.createdAt, updated_at: comment.updatedAt, diff --git a/mcp/reviewComments.ts b/mcp/reviewComments.ts index 6c45531..700491e 100644 --- a/mcp/reviewComments.ts +++ b/mcp/reviewComments.ts @@ -2,12 +2,15 @@ import { type } from "arktype"; import { contextualize, tool } from "./shared.ts"; // graphql query to fetch all review threads with comments and replies +// note: diffSide and startDiffSide are on the thread, not the comment const REVIEW_THREADS_QUERY = ` query ($owner: String!, $repo: String!, $pullNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $pullNumber) { reviewThreads(first: 100) { nodes { + diffSide + startDiffSide comments(first: 100) { nodes { id @@ -16,8 +19,6 @@ query ($owner: String!, $repo: String!, $pullNumber: Int!) { path line startLine - diffSide - startSide url author { login @@ -47,8 +48,6 @@ type GraphQLReviewComment = { path: string; line: number | null; startLine: number | null; - diffSide: "LEFT" | "RIGHT"; - startSide: "LEFT" | "RIGHT" | null; url: string; author: { login: string; @@ -64,10 +63,12 @@ type GraphQLReviewComment = { }; type GraphQLReviewThread = { + diffSide: "LEFT" | "RIGHT"; + startDiffSide: "LEFT" | "RIGHT" | null; comments: { nodes: (GraphQLReviewComment | null)[] | null; } | null; -}; +} | null; type GraphQLResponse = { repository: { @@ -152,6 +153,7 @@ export const GetReviewCommentsTool = tool({ if (!threadBelongsToReview) continue; // include all comments from this thread (original + replies) + // side info comes from thread level, not comment level for (const comment of threadComments) { allComments.push({ id: comment.databaseId, @@ -159,8 +161,8 @@ export const GetReviewCommentsTool = tool({ path: comment.path, line: comment.line, start_line: comment.startLine, - side: comment.diffSide, - start_side: comment.startSide, + side: thread.diffSide, + start_side: thread.startDiffSide, user: comment.author?.login ?? null, created_at: comment.createdAt, updated_at: comment.updatedAt,