Skip to content

feat: use GenerationID to gate stale checkpoints#1511

Open
Linell wants to merge 1 commit intomainfrom
linell/exe-1552-http-timeout-leads-to-duplicate-steps-with-checkpointing
Open

feat: use GenerationID to gate stale checkpoints#1511
Linell wants to merge 1 commit intomainfrom
linell/exe-1552-http-timeout-leads-to-duplicate-steps-with-checkpointing

Conversation

@Linell
Copy link
Copy Markdown
Contributor

@Linell Linell commented May 5, 2026

Summary

Echoes generation_id from the executor on every async checkpoint POST and treats a 409 response 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

  • Added a docs PR that references this PR
  • Added unit/integration tests
  • Added changesets if applicable

Related

EXE-1552: HTTP timeout leads to duplicate steps with checkpointing
inngest/inngest#4108
inngest/inngestgo#213


Note

Echoes generation_id from the executor on every async checkpoint POST and treats a 409 response as a StaleDispatchError, 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.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 5, 2026

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 5, 2026

🦋 Changeset detected

Latest commit: 7174549

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
inngest Minor

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

@inngest-release-bot inngest-release-bot added the 📦 inngest Affects the `inngest` package label May 5, 2026
Copy link
Copy Markdown

@mendral-app mendral-app Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 } : {}),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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>

@Linell Linell changed the title Linell/exe 1552 http timeout leads to duplicate steps with checkpointing feat: use GenerationID to gate stale checkpoints May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 inngest Affects the `inngest` package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants