mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-25 09:02:25 +02:00
Replaces the write-count (_write_count) snapshot mechanism with a clean step-based approach: pregel's create_checkpoint fires snapshots every N pregel steps regardless of whether the channel was written (eager). Key changes: - snapshot_frequency=None (default) for pure delta; int N for snapshot every N steps - DeltaChannel.checkpoint() always returns DELTA_SENTINEL; snapshot logic lives in create_checkpoint which has the step number - create_checkpoint bumps channel version via get_next_version when the channel wasn't written at a snapshot step (eager: always stores the blob) - _DeltaSnapshot NamedTuple registered as EXT_DELTA_SNAPSHOT (code 7) in the msgpack serde — no dict key collision, type tag does the dispatch - InMemorySaver and PostgresSaver _get_channel_writes_history updated: _DeltaSnapshot blobs collect pending_writes before terminating (they encode the NEXT step's transition, not subsumed by the snapshot unlike pre-delta migration blobs) Tests confirm: - Snapshots fire at every N steps even when channel has no write that step - Correct accumulated state after reconstruction from snapshot + replay Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>