Skip to content

Commit 710df37

Browse files
committed
fix(webapp): tolerate missing task on locked + queue-override branch
Match main's pre-PR behavior — when a caller passes `lockToVersion` and a queue override and the task slug isn't registered on that worker version, fall through with `taskKind = undefined` (coalesced to "STANDARD" downstream) and `taskTtl = undefined` instead of throwing. This reverts the throw added earlier in this PR. The trade-off review landed on "strict consistency check is better" twice (CodeRabbit recommended it, Devin pushed back, we kept the throw) — but the net is a behavioral change in the trigger API, and customers running `lockToVersion` + a queue override against a slug that doesn't exist on that version would start getting 4xx errors where they got silent defaults before. Default-to-silent matches main and avoids the surprise. The no-override branch keeps its throw because there's no queue to route to in that case — the failure mode there is unrecoverable.
1 parent b9fc87b commit 710df37

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,23 @@ export class DefaultQueueManager implements QueueManager {
118118
// Pull `triggerSource` (for `taskKind` annotation) and `ttl` from cache.
119119
// On cache hit this is 0 PG queries; on miss the helper falls back to
120120
// a BackgroundWorkerTask lookup and back-fills the cache.
121+
//
122+
// If the task slug isn't on this locked worker version, we tolerate
123+
// the missing row and fall through with `taskKind = undefined`
124+
// (coalesced to "STANDARD" downstream) and `taskTtl = undefined`.
125+
// This matches main's pre-PR behavior — the no-override branch below
126+
// still throws because there's no queue to route to in that case,
127+
// but here the caller already named the queue.
121128
const lockedMeta = await this.resolveLockedTaskMetadata(
122129
lockedBackgroundWorker.id,
123130
request.environment.id,
124131
request.taskId
125132
);
126133

127-
if (!lockedMeta) {
128-
throw new ServiceValidationError(
129-
`Task '${request.taskId}' not found on locked version '${lockedBackgroundWorker.version ?? "<unknown>"
130-
}'.`
131-
);
132-
}
133-
134134
if (request.body.options?.ttl === undefined) {
135-
taskTtl = lockedMeta.ttl ?? undefined;
135+
taskTtl = lockedMeta?.ttl ?? undefined;
136136
}
137-
taskKind = lockedMeta.triggerSource;
137+
taskKind = lockedMeta?.triggerSource;
138138
} else {
139139
// No queue override - resolve default queue + TTL + triggerSource via cache,
140140
// falling back to a single BackgroundWorkerTask lookup on miss.

0 commit comments

Comments
 (0)