The best way to control Claude Code, Codex and more from any computer or phone
fix(composer): keep reviews from different Git hosts in suggestions (#36104)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Simon Maggini committed
Nov 13, 2026 at 11:06 UTC
21b0b7a0573ea4d00b45c0346bec178f367d7550
7 files changed
+96
-19
apps/mobile/src/features/threads/use-composer-command-menu.ts
+2
-1
@@ -1,3 +1,4 @@
1
+import { threadPullRequestKeyOf } from "@t3tools/client-runtime/thread-pull-requests";
2
import * as Dialog from "../../components/ui/Dialog";
3
import type {
4
EnvironmentId,
@@ -358,7 +359,7 @@ export function useComposerCommandMenu({
359
360
if (trigger.kind === "pull-request") {
361
return pullRequestSearch.entries.map((entry) => ({
361
- id: `pr:${entry.projectId}:${entry.repository}:${entry.number}`,
362
+ id: `pr:${entry.projectId}:${threadPullRequestKeyOf(entry)}`,
363
type: "pull-request",
364
pullRequest: {
365
number: entry.number,
apps/mobile/src/state/queries.test.ts
+3
@@ -1,8 +1,10 @@
1
+import { threadPullRequestKeyOf } from "@t3tools/client-runtime/thread-pull-requests";
2
import { filterComposerPullRequestMatches } from "@t3tools/shared/composerPullRequestMatches";
3
import { expect, it } from "@effect/vitest";
4
5
it("keeps an older exact PR in the mobile menu ahead of twenty newer substring matches", () => {
6
const exact = {
7
+ host: "github.com",
8
number: 42,
9
projectId: "project",
10
repository: "example/repo",
@@ -14,6 +16,7 @@ it("keeps an older exact PR in the mobile menu ahead of twenty newer substring m
16
updatedAt: "2026-01-01",
17
}));
18
const matches = filterComposerPullRequestMatches({
19
+ keyOf: threadPullRequestKeyOf,
20
entries: [exact, ...recent, exact],
21
projectId: exact.projectId,
22
repository: exact.repository,
apps/mobile/src/state/queries.ts
+18
-4
@@ -1,3 +1,7 @@
1
+import {
2
+ legacyThreadPullRequestKey,
3
+ threadPullRequestKeyOf,
4
+} from "@t3tools/client-runtime/thread-pull-requests";
5
import {
6
composerPullRequestsFromLinks,
7
filterComposerPullRequestMatches,
@@ -148,11 +152,16 @@ export function useComposerPullRequestSearch(input: {
152
})
153
: null,
154
);
155
+ // Only the host: the URL's full repository path would not match the project's selector.
156
+ const exactEntry = exact.data
157
+ ? { ...exact.data, host: legacyThreadPullRequestKey(exact.data).host }
158
+ : null;
159
const entries = (() => {
160
if (input.query === null || input.projectId === null || input.repository === null) return [];
161
if (/^\d*$/.test(input.query)) {
162
return filterComposerPullRequestMatches({
155
- entries: ready ? [...(exact.data ? [exact.data] : []), ...(list.data?.entries ?? [])] : [],
163
+ keyOf: threadPullRequestKeyOf,
164
+ entries: ready ? [...(exactEntry ? [exactEntry] : []), ...(list.data?.entries ?? [])] : [],
165
linked,
166
projectId: input.projectId,
167
repository: input.repository,
@@ -162,6 +171,7 @@ export function useComposerPullRequestSearch(input: {
171
}
172
if (!ready) {
173
return withLinkedComposerPullRequestsFirst({
174
+ keyOf: threadPullRequestKeyOf,
175
matches: [],
176
linked,
177
query: input.query,
@@ -169,7 +179,7 @@ export function useComposerPullRequestSearch(input: {
179
});
180
}
181
const words = (query ?? "").toLowerCase().split(/\s+/).filter(Boolean);
172
- const found = [...(exact.data ? [exact.data] : []), ...(list.data?.entries ?? [])].filter(
182
+ const found = [...(exactEntry ? [exactEntry] : []), ...(list.data?.entries ?? [])].filter(
183
(entry) =>
184
entry.projectId === input.projectId &&
185
entry.repository.toLowerCase() === input.repository?.toLowerCase() &&
@@ -177,9 +187,13 @@ export function useComposerPullRequestSearch(input: {
187
`${entry.title} ${entry.headBranch} ${entry.baseBranch}`.toLowerCase().includes(word),
188
),
189
);
180
- const unique = new Map<number, (typeof found)[number]>();
181
- for (const entry of found) if (!unique.has(entry.number)) unique.set(entry.number, entry);
190
+ const unique = new Map<string, (typeof found)[number]>();
191
+ for (const entry of found) {
192
+ const key = threadPullRequestKeyOf(entry);
193
+ if (!unique.has(key)) unique.set(key, entry);
194
+ }
195
return withLinkedComposerPullRequestsFirst({
196
+ keyOf: threadPullRequestKeyOf,
197
matches: [...unique.values()].sort((left, right) =>
198
right.updatedAt.localeCompare(left.updatedAt),
199
),
apps/web/src/components/chat/useComposerMenuItems.ts
+14
-2
@@ -1,3 +1,7 @@
1
+import {
2
+ legacyThreadPullRequestKey,
3
+ threadPullRequestKeyOf,
4
+} from "@t3tools/client-runtime/thread-pull-requests";
5
import {
6
matchComposerEnvironmentItems,
7
matchComposerThreadItems,
@@ -327,10 +331,17 @@ export function useComposerMenuItems({
331
) {
332
const exactPullRequest =
333
exactPullRequestLookup.data?.number === pullRequestTriggerNumber
330
- ? [exactPullRequestLookup.data]
334
+ ? [
335
+ {
336
+ ...exactPullRequestLookup.data,
337
+ // Only the host: the URL's full repository path would not match the project's selector.
338
+ host: legacyThreadPullRequestKey(exactPullRequestLookup.data).host,
339
+ },
340
+ ]
341
: [];
342
const matches = /^\d*$/u.test(composerTrigger.query)
343
? filterComposerPullRequestMatches({
344
+ keyOf: threadPullRequestKeyOf,
345
entries: [...exactPullRequest, ...(pullRequestLookup.data?.entries ?? [])],
346
linked: linkedPullRequests,
347
projectId: pullRequestProjectId,
@@ -339,6 +350,7 @@ export function useComposerMenuItems({
350
limit: COMPOSER_PULL_REQUEST_RESULT_LIMIT,
351
})
352
: withLinkedComposerPullRequestsFirst({
353
+ keyOf: threadPullRequestKeyOf,
354
matches: rankPullRequestMatches(
355
(pullRequestLookup.data?.entries ?? []).filter((entry) => {
356
if (
@@ -363,7 +375,7 @@ export function useComposerMenuItems({
375
limit: COMPOSER_PULL_REQUEST_RESULT_LIMIT,
376
});
377
return matches.map((pullRequest) => ({
366
- id: `pull-request:${pullRequest.projectId}:${pullRequest.repository}:${pullRequest.number}`,
378
+ id: `pull-request:${pullRequest.projectId}:${threadPullRequestKeyOf(pullRequest)}`,
379
type: "pull-request",
380
pullRequest: {
381
number: pullRequest.number,
apps/web/src/composer-logic.test.ts
+10
@@ -1,3 +1,4 @@
1
+import { threadPullRequestKeyOf } from "@t3tools/client-runtime/thread-pull-requests";
2
import { filterComposerPullRequestMatches } from "@t3tools/shared/composerPullRequestMatches";
3
import { EnvironmentId, MessageId, ThreadId, type AssistantCitation } from "@t3tools/contracts";
4
import {
@@ -331,30 +332,35 @@ describe("detectComposerTrigger", () => {
332
describe("filterComposerPullRequestMatches", () => {
333
const entries = [
334
{
335
+ host: "github.com",
336
number: 7,
337
projectId: "project-1",
338
repository: "t3tools/t3code",
339
updatedAt: "2026-09-01T12:00:00.000Z",
340
},
341
{
342
+ host: "github.com",
343
number: 8987,
344
projectId: "project-1",
345
repository: "T3Tools/T3Code",
346
updatedAt: "2026-09-03T12:00:00.000Z",
347
},
348
{
349
+ host: "github.com",
350
number: 27,
351
projectId: "project-1",
352
repository: "t3tools/t3code",
353
updatedAt: "2026-09-02T12:00:00.000Z",
354
},
355
{
356
+ host: "github.com",
357
number: 27,
358
projectId: "project-1",
359
repository: "t3tools/t3code",
360
updatedAt: "2026-09-01T13:00:00.000Z",
361
},
362
{
363
+ host: "github.com",
364
number: 70,
365
projectId: "project-2",
366
repository: "t3tools/other",
@@ -365,6 +371,7 @@ describe("filterComposerPullRequestMatches", () => {
371
it("matches and de-duplicates number fragments within one repository, exact match first", () => {
372
expect(
373
filterComposerPullRequestMatches({
374
+ keyOf: threadPullRequestKeyOf,
375
entries,
376
projectId: "project-1",
377
repository: "t3tools/t3code",
@@ -376,18 +383,21 @@ describe("filterComposerPullRequestMatches", () => {
383
384
it("keeps an older exact match when newer substring matches would fill the limit", () => {
385
const exact = {
386
+ host: "github.com",
387
number: 7,
388
projectId: "project-1",
389
repository: "t3tools/t3code",
390
updatedAt: "2020-01-01T00:00:00.000Z",
391
};
392
const newerSubstringMatches = Array.from({ length: 12 }, (_unused, index) => ({
393
+ host: "github.com",
394
number: 700 + index,
395
projectId: "project-1",
396
repository: "t3tools/t3code",
397
updatedAt: `2026-09-${String(index + 1).padStart(2, "0")}T12:00:00.000Z`,
398
}));
399
const matches = filterComposerPullRequestMatches({
400
+ keyOf: threadPullRequestKeyOf,
401
entries: [...newerSubstringMatches, exact],
402
projectId: "project-1",
403
repository: "t3tools/t3code",
packages/shared/src/composerPullRequestMatches.test.ts
+41
-3
@@ -1,6 +1,6 @@
1
import { describe, expect, it } from "vite-plus/test";
2
3
-import type { ThreadPullRequestLink } from "@t3tools/contracts";
3
+import type { ThreadPullRequestKey, ThreadPullRequestLink } from "@t3tools/contracts";
4
5
import {
6
composerPullRequestsFromLinks,
@@ -8,8 +8,12 @@ import {
8
withLinkedComposerPullRequestsFirst,
9
} from "./composerPullRequestMatches.ts";
10
11
+const keyOf = (entry: ThreadPullRequestKey) =>
12
+ `${entry.host.trim().toLowerCase()}/${entry.repository.trim().toLowerCase()}#${entry.number}`;
13
+
14
const entry = (number: number, updatedAt: string) => ({
15
number,
16
+ host: "github.com",
17
projectId: "p1",
18
repository: "owner/repo",
19
updatedAt,
@@ -18,6 +22,7 @@ const entry = (number: number, updatedAt: string) => ({
22
describe("filterComposerPullRequestMatches", () => {
23
it("ranks the exact number above newer substring matches", () => {
24
const result = filterComposerPullRequestMatches({
25
+ keyOf,
26
entries: [entry(1234, "2026-01-03"), entry(123, "2026-01-01"), entry(1230, "2026-01-02")],
27
projectId: "p1",
28
repository: "owner/repo",
@@ -29,6 +34,7 @@ describe("filterComposerPullRequestMatches", () => {
34
35
it("orders by update instant when timestamps carry different UTC offsets", () => {
36
const result = filterComposerPullRequestMatches({
37
+ keyOf,
38
entries: [entry(401, "2026-10-25T02:50:00+02:00"), entry(499, "2026-10-25T02:10:00+01:00")],
39
projectId: "p1",
40
repository: "owner/repo",
@@ -66,6 +72,7 @@ describe("linked pull requests", () => {
72
73
it("offers a linked pull request from another repository above the project's own", () => {
74
const result = filterComposerPullRequestMatches({
75
+ keyOf,
76
entries: [entry(4, "2026-01-03"), { ...entry(4, "2026-01-04"), repository: "owner/other" }],
77
linked: composerPullRequestsFromLinks([link("owner/repo-b", 4)], "p1"),
78
projectId: "p1",
@@ -79,8 +86,27 @@ describe("linked pull requests", () => {
86
]);
87
});
88
89
+ it("keeps linked reviews with the same repository and number on different hosts", () => {
90
+ const github = link("wireshark/wireshark", 1);
91
+ const gitlab = link("wireshark/wireshark", 1, {
92
+ host: "gitlab.com",
93
+ url: "https://gitlab.com/wireshark/wireshark/-/merge_requests/1",
94
+ });
95
+ const result = filterComposerPullRequestMatches({
96
+ keyOf,
97
+ entries: [],
98
+ linked: composerPullRequestsFromLinks([github, gitlab], "p1"),
99
+ projectId: "p1",
100
+ repository: "wireshark/wireshark",
101
+ query: "1",
102
+ limit: 10,
103
+ });
104
+ expect(result.map((match) => match.url)).toEqual([github.url, gitlab.url]);
105
+ });
106
+
107
it("keeps one row for a linked pull request the project listing already has", () => {
108
const result = filterComposerPullRequestMatches({
109
+ keyOf,
110
entries: [entry(4, "2026-01-03")],
111
linked: composerPullRequestsFromLinks([link("Owner/Repo", 4)], "p1"),
112
projectId: "p1",
@@ -98,22 +124,34 @@ describe("linked pull requests", () => {
124
snapshot: { ...link("owner/repo", 7).snapshot!, title: "Fix login" },
125
}),
126
link("owner/repo", 8),
127
+ link("owner/repo", 8, {
128
+ host: "gitlab.com",
129
+ url: "https://gitlab.com/owner/repo/-/merge_requests/8",
130
+ snapshot: { ...link("owner/repo", 8).snapshot!, title: "Fix CI" },
131
+ }),
132
],
133
"p1",
134
);
135
const searching = withLinkedComposerPullRequestsFirst({
136
+ keyOf,
137
matches: [],
138
linked,
139
query: "fix",
140
limit: 10,
141
});
110
- expect(searching.map((match) => match.number)).toEqual([7]);
142
+ expect(searching.map((match) => match.number)).toEqual([7, 8]);
143
const searched = withLinkedComposerPullRequestsFirst({
144
+ keyOf,
145
matches: [entry(9, "2026-01-05"), entry(8, "2026-01-03")],
146
linked,
147
query: "fix",
148
limit: 10,
149
});
117
- expect(searched).toEqual([linked[0], entry(8, "2026-01-03"), entry(9, "2026-01-05")]);
150
+ expect(searched).toEqual([
151
+ linked[0],
152
+ entry(8, "2026-01-03"),
153
+ linked[2],
154
+ entry(9, "2026-01-05"),
155
+ ]);
156
});
157
});
packages/shared/src/composerPullRequestMatches.ts
+8
-9
@@ -1,11 +1,9 @@
1
-import type { ThreadPullRequestLink } from "@t3tools/contracts";
1
+import type { ThreadPullRequestKey, ThreadPullRequestLink } from "@t3tools/contracts";
2
3
import { visibleThreadPullRequests } from "./threadPullRequests.ts";
4
5
-export interface ComposerPullRequestMatch {
6
- readonly number: number;
5
+export interface ComposerPullRequestMatch extends ThreadPullRequestKey {
6
readonly projectId: string;
8
- readonly repository: string;
7
readonly updatedAt: string;
8
}
9
@@ -19,6 +17,7 @@ export function composerPullRequestsFromLinks(
17
: [
18
{
19
projectId,
20
+ host: link.host,
21
repository: link.repository,
22
number: link.number,
23
url: link.url,
@@ -43,10 +42,10 @@ export function filterComposerPullRequestMatches<
42
readonly repository: string;
43
readonly query: string;
44
readonly limit: number;
45
+ readonly keyOf: (entry: Entry | Linked) => string;
46
}): ReadonlyArray<Entry | Linked> {
47
const repository = input.repository.trim().toLowerCase();
48
- const keyOf = (entry: ComposerPullRequestMatch) =>
49
- `${entry.repository.trim().toLowerCase()}#${entry.number}`;
48
+ const { keyOf } = input;
49
const linked = (input.linked ?? []).filter((entry) => String(entry.number).includes(input.query));
50
const linkedKeys = new Set(linked.map(keyOf));
51
const matchingEntries = input.entries.filter(
@@ -62,7 +61,7 @@ export function filterComposerPullRequestMatches<
61
}
62
}
63
const isExactMatch = (entry: ComposerPullRequestMatch) => String(entry.number) === input.query;
65
- const isLinked = (entry: ComposerPullRequestMatch) => linkedKeys.has(keyOf(entry));
64
+ const isLinked = (entry: Entry | Linked) => linkedKeys.has(keyOf(entry));
65
const updatedAtMs = (entry: ComposerPullRequestMatch) => Date.parse(entry.updatedAt) || 0;
66
// Hermes has no ES2023 array methods, so sort a fresh array.
67
return [...uniqueEntries.values()]
@@ -87,9 +86,9 @@ export function withLinkedComposerPullRequestsFirst<
86
readonly linked: ReadonlyArray<Linked>;
87
readonly query: string;
88
readonly limit: number;
89
+ readonly keyOf: (entry: Entry | Linked) => string;
90
}): ReadonlyArray<Entry | Linked> {
91
- const keyOf = (entry: ComposerPullRequestMatch) =>
92
- `${entry.repository.trim().toLowerCase()}#${entry.number}`;
91
+ const { keyOf } = input;
92
const matchesByKey = new Map(input.matches.map((entry) => [keyOf(entry), entry]));
93
const words = input.query.toLowerCase().split(/\s+/u).filter(Boolean);
94
const linked = input.linked.flatMap((entry): Array<Entry | Linked> => {