feat: use GenerationID to gate stale checkpoints#1511
Conversation
🦋 Changeset detectedLatest commit: 7174549 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Needs attention — 1 issue in 1 file
The core logic is sound — the 409 detection, shouldRetry short-circuit, and retriable: false halt are all correct. One bug: the falsy guard on generationId silently drops the field when the value is 0, which is a valid generation ID.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<assessment>
The core logic is sound — the 409 detection, `shouldRetry` short-circuit, and `retriable: false` halt are all correct. One bug: the falsy guard on `generationId` silently drops the field when the value is `0`, which is a valid generation ID.
</assessment>
<file name="packages/inngest/src/api/api.ts">
<issue location="packages/inngest/src/api/api.ts:560">
`generationId: 0` is silently dropped because `0` is falsy. If the executor ever issues generation ID 0, the checkpoint POST omits `generation_id` entirely and the 409 guard never fires.
</issue>
</file>
Tag @mendral-app with feedback or questions. View session
| run_id: args.runId, | ||
| fn_id: args.fnId, | ||
| qi_id: args.queueItemId, | ||
| ...(args.generationId ? { generation_id: args.generationId } : {}), |
There was a problem hiding this comment.
bug (P1): generationId: 0 is silently dropped because 0 is falsy. If the executor ever issues generation ID 0, the checkpoint POST omits generation_id entirely and the 409 guard never fires.
Suggested change
| ...(args.generationId ? { generation_id: args.generationId } : {}), | |
| ...(args.generationId !== undefined ? { generation_id: args.generationId } : {}), |
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/inngest/src/api/api.ts, line 560:
<issue>
`generationId: 0` is silently dropped because `0` is falsy. If the executor ever issues generation ID 0, the checkpoint POST omits `generation_id` entirely and the 409 guard never fires.
</issue>
Summary
Echoes
generation_idfrom the executor on every async checkpoint POST and treats a409response as a stale dispatch (StaleDispatchError), halting execution instead of returning buffered ops. Without this, an HTTP timeout that causes the executor to requeue can race with a late checkpoint: the executor would memoize the returned ops as canonical and chain the next dispatch off a dead invocation, producing duplicate step executions. Pairs with inngest/inngest#4108.Checklist
Related
EXE-1552: HTTP timeout leads to duplicate steps with checkpointing
inngest/inngest#4108
inngest/inngestgo#213
Note
Echoes
generation_idfrom the executor on every async checkpoint POST and treats a 409 response as aStaleDispatchError, halting execution instead of returning buffered ops. This prevents a race condition where an HTTP timeout causes the executor to requeue while a late checkpoint returns buffered ops that get memoized as canonical, producing duplicate step executions.Written by Mendral for commit 7174549.