Skip to content

Commit 73eb8a5

Browse files
committed
fix(webapp): reject gate requests that exceed the three-gate capacity
Prepending the task's inline gate to a full raw gates array could push the set past three; the resolver now throws a clear error instead of silently dropping the last gate. Replays are unaffected: resent stored gates collapse through the dedupe before the check.
1 parent 310c37b commit 73eb8a5

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

apps/webapp/app/runEngine/concerns/queues.server.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -261,20 +261,24 @@ export class DefaultQueueManager implements QueueManager {
261261
undefined;
262262

263263
const seenGates = new Set<string>();
264-
const gates = requestedGates
265-
?.flatMap((gate) => {
266-
const sanitized = sanitizeQueueName(gate.queue);
267-
if (!sanitized) {
268-
return [];
269-
}
270-
const dedupeKey = `${sanitized}${gate.concurrencyKey ?? ""}`;
271-
if (seenGates.has(dedupeKey)) {
272-
return [];
273-
}
274-
seenGates.add(dedupeKey);
275-
return [{ queue: sanitized, concurrencyKey: gate.concurrencyKey }];
276-
})
277-
.slice(0, 3);
264+
const gates = requestedGates?.flatMap((gate) => {
265+
const sanitized = sanitizeQueueName(gate.queue);
266+
if (!sanitized) {
267+
return [];
268+
}
269+
const dedupeKey = `${sanitized}${gate.concurrencyKey ?? ""}`;
270+
if (seenGates.has(dedupeKey)) {
271+
return [];
272+
}
273+
seenGates.add(dedupeKey);
274+
return [{ queue: sanitized, concurrencyKey: gate.concurrencyKey }];
275+
});
276+
277+
if (gates && gates.length > 3) {
278+
throw new ServiceValidationError(
279+
`A run can hold at most three gates (the task's inline limit plus two named limits); this request resolves to ${gates.length}.`
280+
);
281+
}
278282

279283
return {
280284
queueName,

0 commit comments

Comments
 (0)