Repository navigation
fix(azure-ai): honor checkpoint and pending-write ordering - #1209
Draft
JiahuiGu (Jiahui-Gu) wants to merge 1 commit into
Draft
JiahuiGu (Jiahui-Gu) wants to merge 1 commit into
JiahuiGu (Jiahui-Gu) wants to merge 1 commit into
Conversation
This was referenced Oct 20, 2026
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make
FoundryCheckpointSaverhonor LangGraph's checkpoint/history/pending-write ordering independently of State Store enumeration order. This is a standalone SDK fix: no sample, Responses converter, dependency pin, public signature, or checkpoint storage format changes.Root cause
LangGraph defines checkpoint IDs as unique and monotonically increasing. Its standard savers select/order by checkpoint ID, and
beforeis an exclusive ID bound. Foundry State Store enumerates resource creation order instead. Those are different contracts: tied timestamps, delayed writes, replay, or backfill must not make an older checkpoint become "latest".Previously
aget_tupletrustedlist_keys(order="desc", limit=1), andalistreused a storage item cursor forbefore. A missing or filtered-out boundary could return no history; creation order could also include checkpoints newer than the requested ID bound. Existing tests explicitly encoded creation order and were corrected against LangGraph's contract.The adjacent recovery path also persisted
task_pathbut ignored it when loading pending writes. Newer LangGraph's delta-channel replay requires(task_path, task_id, index)order; task IDs are hashes, not execution order. Otherwise an order-sensitive reducer can reconstruct a different state after reopen.Design
limit/before. Namespace and metadata filters remain supported.finallycleanup.beforeas an exclusive ID bound without requiring the boundary object to exist or match a tag filter.(task_path, task_id, index)order, defaulting missing legacytask_pathto"".No auxiliary "latest" index/pointer is introduced: without service-side checkpoint-ID ordering it would need additional concurrency/migration rules and still would not repair history and
before. This implementation favors correct existing-format reads. Latest/history queries scan matching key pages and sort their keys, so request count and memory grow with retained history. It does not download every checkpoint blob just to find the latest. This cost is documented rather than hidden.The separate Azure SDK local-ordering fix #49617 is related but not required: this adapter must remain correct against either local implementation and against hosted storage. Neither PR needs the sample PR to merge.
Validation
The original latest/history/paging/disappearing-item and local-reopen regressions failed before the fix. A pending-write path-order regression also failed before that correction. Retained tests cover reordered creation, multi-page limiting, existing/deleted/filtered boundaries, namespaces, metadata, legacy pending writes, real local saver reopen, approval execution exactly once, and an order-sensitive parallel DeltaChannel restored after reopen. No new sample-specific test framework is introduced.
Existing newer-LangGraph failures (not suppressed)
TestParallelInterrupts.test_stays_paused_until_every_branch_is_answeredandtest_ignores_a_repeated_answer_to_the_same_interruptalso fail against the unmodified publishedlangchain-azure-ai==1.2.11with this newer dependency combination. They useInMemorySaver, not the changed Foundry saver. A pure LangGraph reproduction shows the final response stream contains onlyb=B, while the final checkpoint correctly retains botha=Aandb=B. The existing tests require both messages in the final response. They remain unchanged and failing; this PR does not silently weaken them or claim to resolve that separate streaming-output compatibility question.Boundaries
These are local SDK and HTTP integration checks, not a new cloud deployment. Native message history and actual edited execution were verified; no approval is synthesized, no sleep/fallback masks failures, and the sample is not changed. No package publication, merge, extra evaluation job, or unrelated test repair is performed.
AI assistance: Codex assisted with implementation and verification.