Repository navigation
fix(agentserver): preserve local state-store ordering and paging - #49617
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
Contributor
|
Thank you for your contribution JiahuiGu (@Jiahui-Gu)! We will review the pull request and get back to you soon. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 7 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
This branch has not been deployed
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
Fix the local
FoundryStateStoreordering/pagination contract as a standalone SDK change. No LangChain-specific keys, sample branches, generated models, service requests, or public API signatures change.Root cause and scope
The local backend persists public timestamps in whole seconds and previously sorted equal timestamps by a SHA256-derived item ID. Rapid writes therefore had arbitrary creation order. The problem reproduces without an agent: after saving twelve checkpoints, a descending one-item query selected step 3 rather than step 11. Upgrading LangChain did not introduce the defect.
The same listing path also filtered away cursor items before resolving their position and returned the beginning of the entire prefix for
before, rather than the adjacent preceding page. This change fixes that listing lifecycle rather than special-casing one checkpoint consumer.Design
(created_at, id)order. Original same-second creation order cannot be recovered from those files; it is not guessed. A file rewritten by an older SDK without sequence fields follows the same compatibility path.limit/orderbounds.The generic store does not learn application revision ordering. LangGraph's checkpoint-ID ordering belongs in its adapter and is addressed separately by langchain-azure #1209. There is no latest-checkpoint pointer or sample fallback in this PR; neither fix depends on the other's release.
Validation
Tests were added and run red before implementation: same-second order, both creation APIs, backward paging, filtered-out cursor positions, expiry, and legacy-file continuation failed on the original backend. Invalid-query and recreated-cursor regressions were also observed failing before their fixes.
Core skips are existing POSIX-only/Windows-encoding checks and live telemetry tests without Azure configuration. Responses skips are existing platform/fixture-dependent tests. These are local tests; no cloud-service correctness, model-quality evaluation, simultaneous multi-process writers, or full CI matrix is claimed. Local state access retains its existing process-local locking and atomic-file replacement boundary.
Compatibility / release notes
fixentry and the state-store guide describe the behavior and limitations. No release or package-version bump is performed here.AI assistance: Codex assisted with implementation and verification.