The best way to control Claude Code, Codex and more from any computer or phone
fix(gitlab): file and image comments appear as review threads (#30425)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Antony committed
Nov 5, 2026 at 22:34 UTC
25b53299b75d4d8d1d0667ad47e9cfed3749776e
2 files changed
+55
-12
packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts
+40
-8
@@ -1022,6 +1022,40 @@ layer("GitLabPullRequestCli.layer", (it) => {
1022
],
1023
},
1024
{ id: "def456", notes: [{ id: 3, body: "ship it", created_at: "2026-07-01Z" }] },
1025
+ {
1026
+ id: "file789",
1027
+ notes: [
1028
+ {
1029
+ id: 4,
1030
+ body: "split this file",
1031
+ created_at: "2026-07-01Z",
1032
+ position: {
1033
+ position_type: "file",
1034
+ new_path: "src/b.ts",
1035
+ old_path: "src/b.ts",
1036
+ new_line: null,
1037
+ old_line: null,
1038
+ },
1039
+ },
1040
+ ],
1041
+ },
1042
+ {
1043
+ id: "img012",
1044
+ notes: [
1045
+ {
1046
+ id: 5,
1047
+ body: "logo is blurry",
1048
+ created_at: "2026-07-01Z",
1049
+ position: {
1050
+ position_type: "image",
1051
+ new_path: "logo.png",
1052
+ old_path: "logo.png",
1053
+ new_line: null,
1054
+ old_line: null,
1055
+ },
1056
+ },
1057
+ ],
1058
+ },
1059
]),
1060
),
1061
),
@@ -1034,14 +1068,12 @@ layer("GitLabPullRequestCli.layer", (it) => {
1068
number: 7,
1069
});
1070
1037
- assert.strictEqual(threads.length, 1);
1038
- expect(threads[0]).toMatchObject({
1039
- id: "abc123",
1040
- path: "src/a.ts",
1041
- line: 12,
1042
- side: "right",
1043
- isResolved: true,
1044
- });
1071
+ expect(threads.map(({ id, path, line, side }) => ({ id, path, line, side }))).toEqual([
1072
+ { id: "abc123", path: "src/a.ts", line: 12, side: "right" },
1073
+ { id: "file789", path: "src/b.ts", line: null, side: "right" },
1074
+ { id: "img012", path: "logo.png", line: null, side: "right" },
1075
+ ]);
1076
+ expect(threads[0]).toMatchObject({ isResolved: true });
1077
assert.strictEqual(threads[0]?.comments.length, 2);
1078
}),
1079
);
packages/source-control-gitlab/src/server/gitLabMergeRequestJson.ts
+15
-4
@@ -547,10 +547,21 @@ export function decodeDiscussionsJson(
547
const notes = (discussion.value.notes ?? []).filter((note) => note.system !== true);
548
const root = notes[0];
549
const position = root?.position;
550
- if (root === undefined || !position || position.position_type !== "text") continue;
551
- const side = position.new_line === null || position.new_line === undefined ? "left" : "right";
552
- const path = trimmed(side === "left" ? position.old_path : position.new_path);
553
- const line = side === "left" ? position.old_line : position.new_line;
550
+ if (root === undefined || !position) continue;
551
+ let side: "left" | "right";
552
+ let path: string | null;
553
+ let line: number | null | undefined;
554
+ if (position.position_type === "text") {
555
+ side = position.new_line === null || position.new_line === undefined ? "left" : "right";
556
+ path = trimmed(side === "left" ? position.old_path : position.new_path);
557
+ line = side === "left" ? position.old_line : position.new_line;
558
+ } else if (position.position_type === "file" || position.position_type === "image") {
559
+ side = "right";
560
+ path = trimmed(position.new_path) ?? trimmed(position.old_path);
561
+ line = null;
562
+ } else {
563
+ continue;
564
+ }
565
if (path === null) continue;
566
threads.push({
567
id: discussion.value.id,