[PR #6870] checkpoint: preserve causal latest order in InMemorySaver #5362

Open
opened 2026-02-20 17:51:36 -05:00 by yindo · 0 comments
Owner

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

State: open
Merged: No


Problem

InMemorySaver.get_tuple() selected latest checkpoint via lexical max(checkpoint_id), which can violate causal ordering for equal timestamps or custom checkpoint IDs.

Why now

Equal-timestamp checkpoints need deterministic causal retrieval to keep replay behavior stable.

What changed

  • Changed InMemorySaver.get_tuple() to return the last-written checkpoint using insertion order.
  • Added regression test test_equal_timestamp_uses_insertion_order_for_latest.

Validation

  • make format && make lint && make test in libs/checkpoint (pass)

Refs #6869

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6870 **State:** open **Merged:** No --- ## Problem `InMemorySaver.get_tuple()` selected latest checkpoint via lexical `max(checkpoint_id)`, which can violate causal ordering for equal timestamps or custom checkpoint IDs. ## Why now Equal-timestamp checkpoints need deterministic causal retrieval to keep replay behavior stable. ## What changed - Changed `InMemorySaver.get_tuple()` to return the last-written checkpoint using insertion order. - Added regression test `test_equal_timestamp_uses_insertion_order_for_latest`. ## Validation - `make format && make lint && make test` in `libs/checkpoint` (pass) Refs #6869
yindo added the pull-request label 2026-02-20 17:51:36 -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#5362