@devries-cameron20 / t3code-1 / commits / f92c5e8f98
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): review summary line comments keep which side they refer to (#38276)

Co-authored-by: Grok 4.7 <noreply@x.ai> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Wout Stiens committed Nov 17, 2026 at 20:19 UTC f92c5e8f98246ea5537e3ea002fb7bb8ffd84451
2 files changed +25 -4
apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts
+15
@@ -1215,6 +1215,21 @@ describe("adding a remark to the chat", () => {
1215 ].join("\n\n"),
1216 );
1217
1218 + const beforeContext = buildPullRequestCommentContext(
1219 + {
1220 + ...pullRequest,
1221 + reviewThreads: reviewThreads.map((thread) => ({ ...thread, side: "left" as const })),
1222 + reviewThreadsTruncated: false,
1223 + },
1224 + { kind: "comment", comment: review },
1225 + )!;
1226 + const beforeRecord = reviewCommentContextRecord(beforeContext);
1227 + const beforePrompt = projectComposerContextForProvider({
1228 + text: formatComposerContextReference(beforeRecord),
1229 + records: [beforeRecord],
1230 + });
1231 + expect(beforePrompt).toContain("`src/main.rs` line 12 (before)");
1232 +
1233 const sent = reviewCommentContextRecord(
1234 buildPullRequestCommentContext(
1235 { ...pullRequest, reviewThreads, reviewThreadsTruncated: false },
apps/web/src/components/pullRequest/pullRequestDetail.logic.ts
+10 -4
@@ -927,11 +927,17 @@ function reviewThreadText(thread: PullRequestReviewThread): string {
927 .trim();
928 }
929
930 +/** A thread's line, marked when it is numbered as in the base branch, the diff's left side. */
931 +function reviewThreadLine(thread: PullRequestReviewThread): string | null {
932 + return thread.line === null ? null : `${thread.line}${thread.side === "left" ? " (before)" : ""}`;
933 +}
934 +
935 function reviewThreadContext(
936 thread: PullRequestReviewThread,
937 pullRequestNumber: number,
938 ): ReviewCommentContext {
939 const lineIndex = Math.max(0, (thread.line ?? 1) - 1);
940 + const line = reviewThreadLine(thread);
941 return {
942 id: `pull-request-finding:${thread.id}`,
943 sectionId: `pull-request:${pullRequestNumber}`,
@@ -939,8 +945,7 @@ function reviewThreadContext(
945 filePath: thread.path,
946 startIndex: lineIndex,
947 endIndex: lineIndex,
942 - rangeLabel:
943 - thread.line === null ? "file" : `L${thread.line}${thread.side === "left" ? " (before)" : ""}`,
948 + rangeLabel: line === null ? "file" : `L${line}`,
949 // Strip bot bookkeeping comments before bounding finding text.
950 text: bounded(reviewThreadText(thread)),
951 diff: "",
@@ -1340,8 +1345,9 @@ function reviewLineComments(
1345 if (body === null || !pullRequestAnchorMatchesUrl(anchor.anchor, lineComment.reviewUrl)) {
1346 return [];
1347 }
1343 - const line = thread.line === null ? "" : ` line ${thread.line}`;
1344 - return [`${lineComment.author?.login ?? "ghost"} on \`${thread.path}\`${line}: ${body}`];
1348 + const line = reviewThreadLine(thread);
1349 + const at = line === null ? "" : ` line ${line}`;
1350 + return [`${lineComment.author?.login ?? "ghost"} on \`${thread.path}\`${at}: ${body}`];
1351 }),
1352 );
1353 // Threads or their replies can be partly loaded; then an empty match proves nothing.