The best way to control Claude Code, Codex and more from any computer or phone
fix(server): match webhook existence filters on wildcard objects (#23414)
Co-authored-by: maria-rcks <maria@kuuro.net>
Aditya Garud committed
Nov 1, 2026 at 07:34 UTC
ec6020e884b843221c4b8b9a0b9549dc21452c68
2 files changed
+24
apps/server/src/scheduledTasks/webhookFilter.test.ts
+22
@@ -16,6 +16,28 @@ const issueComment: WebhookRequest = {
16
};
17
18
describe("findFailedWebhookFilter", () => {
19
+ it("matches exists on wildcard object values", () => {
20
+ assert.isNull(
21
+ findFailedWebhookFilter([{ path: "body.issue.labels[]", op: "exists" }], issueComment),
22
+ );
23
+ assert.isNull(
24
+ findFailedWebhookFilter([{ path: "body.issues[].labels", op: "exists" }], {
25
+ ...issueComment,
26
+ bodyText: JSON.stringify({ issues: [{ labels: [] }] }),
27
+ }),
28
+ );
29
+ });
30
+
31
+ it("rejects exists when wildcard values are all null or missing", () => {
32
+ assert.deepEqual(
33
+ findFailedWebhookFilter([{ path: "body.issues[].labels", op: "exists" }], {
34
+ ...issueComment,
35
+ bodyText: JSON.stringify({ issues: [{ labels: null }, {}] }),
36
+ }),
37
+ { index: 0, path: "body.issues[].labels" },
38
+ );
39
+ });
40
+
41
it("matches a wildcard path when any element matches", () => {
42
assert.isNull(
43
findFailedWebhookFilter(
apps/server/src/scheduledTasks/webhookFilter.ts
+2
@@ -36,6 +36,8 @@ function matchesScalar(filter: ScheduledTaskWebhookFilter, text: string): boolea
36
*/
37
function matchesWebhookFilter(filter: ScheduledTaskWebhookFilter, value: unknown): boolean {
38
if (Array.isArray(value) && /\[\]/.test(filter.path)) {
39
+ if (filter.op === "exists")
40
+ return value.some((element) => element !== null && element !== undefined);
41
const texts = value.map(scalarText).filter((text): text is string => text !== undefined);
42
if (filter.op === "notEquals") return texts.every((text) => text !== filter.value);
43
return texts.some((text) => matchesScalar(filter, text));