The best way to control Claude Code, Codex and more from any computer or phone
fix(client-runtime): a search query pasted from github.com lists pull requests again (#30150)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 10, 2026 at 18:53 UTC
d152d2c8240618f60308c3b42a160a414be57538
2 files changed
+39
-6
packages/client-runtime/src/pullRequestQuery.test.ts
+15
@@ -33,6 +33,7 @@ describe("reading qualifiers out of a typed query", () => {
33
review: "changes-requested",
34
checks: "failing",
35
});
36
+ expect(parsePullRequestQuery("-draft:true").filters).toEqual({ draft: "hide" });
37
});
38
39
it("leaves an unknown value and a stray colon as text, and reads an unknown key as a label", () => {
@@ -53,6 +54,20 @@ describe("reading qualifiers out of a typed query", () => {
54
]);
55
});
56
57
+ // regression: #30131 a query pasted from github.com lists nothing
58
+ it("ignores GitHub's own search qualifiers instead of reading them as labels", () => {
59
+ expect(
60
+ parsePullRequestQuery(
61
+ "is:pr state:open archived:false repo:org/repo org:org user:alice sort:updated-desc -repo:org/fork -state:closed fix",
62
+ ),
63
+ ).toEqual({ text: "fix", filters: {} });
64
+ });
65
+
66
+ it("sets no author when the query names more than one", () => {
67
+ expect(parsePullRequestQuery("author:alice author:bob").filters).toEqual({});
68
+ expect(parsePullRequestQuery("author:me author:@me").filters).toEqual({ author: "me" });
69
+ });
70
+
71
it("cuts a typed query back to what the contract carries", () => {
72
const many = Array.from({ length: 14 }, (_, index) => `l${index}`).join(",");
73
const long = "x".repeat(240);
packages/client-runtime/src/pullRequestQuery.ts
+24
-6
@@ -29,6 +29,11 @@ function splitQualifierList(raw: string): string[] {
29
.filter((part) => part.length > 0);
30
}
31
32
+/** `me` and `@me` both name the viewer; logins are case-insensitive. */
33
+function authorKey(login: string): string {
34
+ return login.toLowerCase().replace(/^@me$/, "me");
35
+}
36
+
37
function boundedNames(names: ReadonlyArray<string>): string[] {
38
return names
39
.slice(0, MAX_QUALIFIER_VALUES)
@@ -43,7 +48,8 @@ export function parsePullRequestQuery(raw: string): {
48
const text: string[] = [];
49
const labels: string[][] = [];
50
const excludedLabels: string[] = [];
46
- let author: string | undefined;
51
+ // `null` once two different logins are named: GitHub ORs them, the contract carries one.
52
+ let author: string | null | undefined;
53
let draft: PullRequestListFilters["draft"];
54
let review: PullRequestListFilters["review"];
55
let checks: PullRequestListFilters["checks"];
@@ -59,13 +65,16 @@ export function parsePullRequestQuery(raw: string): {
65
else labels.push(names);
66
continue;
67
}
62
- case "author":
68
+ case "author": {
69
if (negated) break;
64
- author = value.slice(0, MAX_QUALIFIER_LENGTH).trim();
70
+ const login = value.slice(0, MAX_QUALIFIER_LENGTH).trim();
71
+ if (author === undefined) author = login;
72
+ else if (author === null || authorKey(author) !== authorKey(login)) author = null;
73
continue;
74
+ }
75
case "draft":
67
- if (negated || (value.toLowerCase() !== "true" && value.toLowerCase() !== "false")) break;
68
- draft = value.toLowerCase() === "true" ? "only" : "hide";
76
+ if (value.toLowerCase() !== "true" && value.toLowerCase() !== "false") break;
77
+ draft = (value.toLowerCase() === "true") !== negated ? "only" : "hide";
78
continue;
79
case "review": {
80
const decision = negated ? undefined : REVIEW_VALUES[value.toLowerCase()];
@@ -80,6 +89,15 @@ export function parsePullRequestQuery(raw: string): {
89
checks = state;
90
continue;
91
}
92
+ // GitHub's own search qualifiers, not labels: the list sets scope and order itself.
93
+ case "is":
94
+ case "archived":
95
+ case "state":
96
+ case "repo":
97
+ case "org":
98
+ case "user":
99
+ case "sort":
100
+ continue;
101
case "":
102
break;
103
default:
@@ -104,7 +122,7 @@ export function parsePullRequestQuery(raw: string): {
122
...(excludedLabels.length === 0
123
? {}
124
: { excludedLabels: excludedLabels.slice(0, MAX_QUALIFIER_VALUES) }),
107
- ...(author === undefined ? {} : { author }),
125
+ ...(typeof author === "string" ? { author } : {}),
126
...(draft === undefined ? {} : { draft }),
127
...(review === undefined ? {} : { review }),
128
...(checks === undefined ? {} : { checks }),