EncryptedSerializer: deleting a thread's newest checkpoint row silently rolls the thread back to an earlier state (no head/sequence check)
Checked other resources
- This is a bug, not a usage question.
- I added a clear and descriptive title that summarizes this issue.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangGraph rather than my code.
- The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).
- This is not related to the langchain-community package.
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Related Issues / PRs
#9004, #9027
Reproduction Steps / Example Code (Python)
# Follow-up to #9004 and #9027, filed separately per maintainer request in #9004.
# Different mechanism: AAD authenticates a row that is present, but says nothing
# about a row that has been removed. Deleting a thread's newest checkpoint row
# silently rolls the thread back to its previous checkpoint. Encryption + the
# #9027 AAD binding do not help: every remaining row is genuine and authenticates.
#
# Measured on langgraph-checkpoint 4.2.0, langgraph-checkpoint-sqlite 3.1.1,
# EncryptedSerializer on SqliteSaver, Python 3.12.
#
# Steps:
# 1. Seed a thread through the checkpointer's own API so it has >= 2 checkpoints.
# 2. Record the current state via get_state().
# 3. With the checkpointer stopped, delete the newest checkpoint row for that
# thread directly in the SQLite store (plain SQL, no keys needed).
# 4. Restart and read the thread's state via get_state().
#
# Observed:
# get_state() returns the PREVIOUS (older) state with no exception.
# The agent resumes from it as genuine. A decision recorded only in the deleted
# head (e.g. a later approved=True) is silently reverted to the earlier value.
# In the agmi harness this is: "C head deletion: ACCEPTED".
#
# Full self-contained reproduction script (same harness as #9004, case C):
# https://github.com/tech4biz-yasha/agmi/blob/main/experiments/langgraph_aad_replay.py
#
# Why #9027's AAD does not cover this:
# AAD ties each ciphertext to its row identity, so a present row cannot be moved
# or substituted. Deletion forges nothing and moves nothing, so there is no tag
# to fail. Detecting it needs an expected-head notion: a per-thread monotonic
# sequence with a stored high-water mark, or a signed head pointer, so a missing
# newest row is noticed on load.
#
# Suggested fix (complementary to #9027, not a replacement):
# Maintain a per-thread head/sequence marker that load() verifies against, and
# raise if the newest expected checkpoint is absent.Error Message and Stack Trace (if applicable)
Description
- I'm using the LangGraph SQLite checkpointer with EncryptedSerializer.
- I expect that if the checkpoint store is tampered with, the checkpointer refuses or signals it, the way #9027 now rejects moved/replayed rows with a MAC failure.
- Instead, if an attacker with write access deletes a thread's newest checkpoint row, the thread silently resumes from its previous checkpoint on the next load, with no error. Encryption and the #9027 AAD binding do not detect this, because deletion removes a genuine row rather than substituting one.
System Info
System Information
OS: Darwin OS Version: Darwin Kernel Version 25.6.0: Fri Jul 31 19:17:12 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T8103 Python Version: 3.12.14 (main, Aug 12 2026, 13:57:54) [Clang 21.0.0 (clang-2100.1.1.101)]
Package Information
langchain_core: 1.6.3 langsmith: 0.12.4 langchain_protocol: 0.0.19 langgraph_sdk: 0.4.5
Optional packages not installed
deepagents deepagents-cli
Other Dependencies
anyio: 4.15.1 cachetools: 7.1.8 distro: 1.9.0 google-genai: 2.23.0 httpx: 0.28.1 httpx2: 2.12.0 jsonpatch: 1.33 openai: 2.54.0 openai-agents: 0.20.0 opentelemetry-api: 1.30.0 opentelemetry-exporter-otlp-proto-http: 1.30.0 opentelemetry-sdk: 1.30.0 orjson: 3.12.0 packaging: 26.3 pydantic: 2.13.5 pytest: 9.1.1 pyyaml: 6.0.3 requests: 2.34.2 requests-toolbelt: 1.0.0 rich: 15.0.0 sniffio: 1.3.1 tenacity: 9.1.4 typing-extensions: 4.16.0 uuid-utils: 0.17.1 websockets: 15.0.1 wrapt: 1.17.3 xxhash: 4.0.1 zstandard: 0.25.0 langgraph-checkpoint: 4.2.0 langgraph-checkpoint-sqlite: 3.1.1
Source: langchain-ai/langgraph