@devries-cameron20 / t3code Mirror · read-only / commits / b4dfd75624
Fork 0

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, 08:30 UTC

fix(client-runtime): issues held by two environments list once (#38205)

Julius Marminge committed Nov 17, 2026 at 08:23 UTC b4dfd75624fade1a8c9596810016d0c33b8a5a4b
2 files changed +73
packages/client-runtime/src/issueList.test.ts
+69
@@ -10,6 +10,7 @@ import { describe, expect, it } from "vite-plus/test";
10
11 import {
12 continueIssuePage,
13 + groupIssues,
14 holdIssuePages,
15 issueCursorsForHost,
16 issueFilterScopes,
@@ -153,3 +154,71 @@ describe("issueFilterScopes", () => {
154 expect(issueFilterScopes(held, [])).toEqual([]);
155 });
156 });
157 +
158 +describe("groupIssues", () => {
159 + it("lists an issue once when two environments hold the same repository", () => {
160 + const github = {
161 + tracker: "github",
162 + host: "github.com",
163 + projectCount: 1,
164 + capabilities: { labels: true, assignees: true },
165 + configured: true,
166 + detail: null,
167 + } as IssueTrackerSummary;
168 + const page = answer({
169 + trackers: [github],
170 + entries: [entry({ key: "1" }), entry({ key: "2" })],
171 + });
172 + const held = holdIssuePages(
173 + [
174 + [environmentId, page],
175 + [
176 + "env-2" as EnvironmentId,
177 + answer({
178 + ...page,
179 + entries: page.entries.map((row) => ({ ...row, projectId: "other" as ProjectId })),
180 + }),
181 + ],
182 + ],
183 + new Map(),
184 + );
185 + const [group] = groupIssues(held, "", []);
186 + expect(group!.rows.map((row) => row.displayKey)).toEqual(["#1", "#2"]);
187 + });
188 +
189 + it("keeps same-keyed issues from two Linear workspaces apart", () => {
190 + const linear = {
191 + tracker: "linear",
192 + host: "linear.app",
193 + projectCount: 1,
194 + capabilities: { labels: true, assignees: true },
195 + configured: true,
196 + detail: null,
197 + } as IssueTrackerSummary;
198 + const inWorkspace = (workspace: string) =>
199 + answer({
200 + trackers: [linear],
201 + entries: [
202 + entry({
203 + tracker: "linear" as IssueTrackerKind,
204 + host: "linear.app",
205 + scope: "ENG",
206 + key: "ENG-1",
207 + url: `https://linear.app/${workspace}/issue/ENG-1`,
208 + }),
209 + ],
210 + });
211 + const held = holdIssuePages(
212 + [
213 + [environmentId, inWorkspace("acme")],
214 + ["env-2" as EnvironmentId, inWorkspace("globex")],
215 + ],
216 + new Map(),
217 + );
218 + const [group] = groupIssues(held, "", []);
219 + expect(group!.rows.map((row) => row.url)).toEqual([
220 + "https://linear.app/acme/issue/ENG-1",
221 + "https://linear.app/globex/issue/ENG-1",
222 + ]);
223 + });
224 +});
packages/client-runtime/src/issueList.ts
+4
@@ -115,6 +115,7 @@ export function groupIssues(
115 more: EnvironmentId[];
116 }
117 >();
118 + const listed = new Set<string>();
119 const needle = query.toLowerCase();
120 for (const [environmentId, page] of held) {
121 for (const tracker of page.answer.trackers) {
@@ -137,6 +138,9 @@ export function groupIssues(
138 !entry.displayKey.toLowerCase().includes(needle)
139 )
140 continue;
141 + // Environments holding the same repository answer the same issue; the first one keeps it.
142 + if (listed.has(entry.url)) continue;
143 + listed.add(entry.url);
144 group.rows.push({ ...entry, environmentId });
145 }
146 for (const error of page.errors) {