[PR #6223] fix(langgraph): fix nested subgraph checkpoint replay #4913

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

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

State: closed
Merged: No


Overview

Subgraphs do not have a checkpoint ID at config.configurable.checkpoint_id. In PregelLoop.__enter__ when the most recent checkpoint tuple is retrieved, if no checkpoint ID exists, checkpointer.get_tuple gets the maximum checkpoint in the namespace. This causes issues when time-traveling to a checkpoint preceding an already-executed subgraph, because the subgraph will replay the global latest checkpoint (in the subgraph namespace) instead of re-executing.

This PR adds some protections to ensure that when time-travelling back to a node that executes a subgraph, we ignore checkpoints newer than the boundary checkpoint so the subgraph reruns instead of replaying future state.

Tests

  • tests/test_pregel.py::test_subgraph_resume_reexecutes_from_valid_checkpoint
  • tests/test_pregel_async.py::test_subgraph_resume_reexecutes_from_valid_checkpoint

These are modeled after https://github.com/langchain-ai/langgraph/issues/6165, which this PR solves

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6223 **State:** closed **Merged:** No --- Overview Subgraphs do not have a checkpoint ID at `config.configurable.checkpoint_id`. In `PregelLoop.__enter__` when the most recent checkpoint tuple is retrieved, if no checkpoint ID exists, `checkpointer.get_tuple` gets the maximum checkpoint in the namespace. This causes issues when time-traveling to a checkpoint preceding an already-executed subgraph, because the subgraph will replay the global latest checkpoint (in the subgraph namespace) instead of re-executing. This PR adds some protections to ensure that when time-travelling back to a node that executes a subgraph, we ignore checkpoints newer than the boundary checkpoint so the subgraph reruns instead of replaying future state. Tests - tests/test_pregel.py::test_subgraph_resume_reexecutes_from_valid_checkpoint - tests/test_pregel_async.py::test_subgraph_resume_reexecutes_from_valid_checkpoint These are modeled after https://github.com/langchain-ai/langgraph/issues/6165, which this PR solves
yindo added the pull-request label 2026-02-20 17:50:56 -05:00
yindo closed this issue 2026-02-20 17:50:56 -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#4913