[PR #6117] fix(prebuilt): guard missing 'step' in SyncPregelLoop.__enter__ with default + warning #4845

Closed
opened 2026-02-20 17:50:50 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/6117

State: closed
Merged: No


Description:
-Fixed KeyError: 'step' in SyncPregelLoop.enter when using persistent checkpoint backends like PostgresSaver.
-Added a guard: if checkpoint_metadata is missing "step", it defaults to 0 and emits a warning.
-Ensures first-run threads work correctly while keeping existing threads with "step" fully compatible.
Issue:
-Fixes the bug where first-run threads with PostgresSaver would crash with KeyError: 'step'.
-Closes #6104

Tests Added:
Negative case: missing "step" → defaults to 0 + warning raised.
Positive case: existing "step" → resumes correctly, no warning.

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6117 **State:** closed **Merged:** No --- Description: -Fixed KeyError: 'step' in SyncPregelLoop.__enter__ when using persistent checkpoint backends like PostgresSaver. -Added a guard: if checkpoint_metadata is missing "step", it defaults to 0 and emits a warning. -Ensures first-run threads work correctly while keeping existing threads with "step" fully compatible. Issue: -Fixes the bug where first-run threads with PostgresSaver would crash with KeyError: 'step'. -Closes #6104 Tests Added: Negative case: missing "step" → defaults to 0 + warning raised. Positive case: existing "step" → resumes correctly, no warning.
yindo added the pull-request label 2026-02-20 17:50:50 -05:00
yindo closed this issue 2026-02-20 17:50:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4845