mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-03 03:38:44 +02:00
Addressing an older checkpoint creates a fork: the shared base ends up with two children and keeps the checkpoint_writes of the branch the fork abandons. Nothing records which child consumed which write, so the DeltaChannel ancestor walk collected the abandoned branch's writes too. Live execution was correct; only the reconstruction after a reload was wrong, and it was wrong on every saver. Fixed on the write side, so no saver changes are needed. A run launched against an explicitly addressed checkpoint forces every DeltaChannel to snapshot into its first checkpoint, terminating the walk inside the fork instead of at the shared base. This mirrors the existing force-snapshot for Overwrite writes, hence the rename to _delta_channels_forced_snapshot. update_state against an older checkpoint takes the same path, for the same reason is_fresh_thread already does. A channel with no value at the fork base cannot carry a snapshot blob yet, so the request stays queued until the first superstep that gives it one. Cost is one snapshot per addressed run, not per superstep. Fixes #8443 Co-Authored-By: AnnaSuSu <64579968+AnnaSuSu@users.noreply.github.com> Co-Authored-By: UditDewan <194863456+UditDewan@users.noreply.github.com>