fix(langgraph): stabilize load-sensitive stream ordering - #2593
Conversation
Python Preview PackagesVersion
Install with uvAdd the TestPyPI index to your [[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = trueThen install the packages you need: # Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1788434009' --index testpypi
# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1788434009' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1788434009' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1788434009' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1788434009' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1788434009' --index testpypiInstall with pippip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
ag-ui-protocol==0.0.0.dev1788434009
Commit: 4d46f8d |
@ag-ui/a2a-middleware
@ag-ui/a2ui-middleware
@ag-ui/event-throttle-middleware
@ag-ui/mcp-apps-middleware
@ag-ui/mcp-middleware
@ag-ui/a2a
@ag-ui/adk
@ag-ui/ag2
@ag-ui/agno
@ag-ui/aws-strands
@ag-ui/claude-agent-sdk
@ag-ui/claude-managed-agents
@ag-ui/crewai
@ag-ui/langchain
@ag-ui/langgraph
@ag-ui/llamaindex
@ag-ui/mastra
@ag-ui/pydantic-ai
@ag-ui/vercel-ai-sdk
@ag-ui/watsonx
@ag-ui/a2ui-toolkit
create-ag-ui-app
@ag-ui/client
@ag-ui/core
@ag-ui/encoder
@ag-ui/proto
commit: |
contextablemark
left a comment
There was a problem hiding this comment.
There’s one state-cache gap I think we should fix before merging.
The default stream configuration appears safe: it includes values, and in a real Agent Server repro the updated root values arrived before the first nested event in 300/300 concurrent runs. The regression is still deterministic for the supported forwardedProps.streamMode override when values is omitted: after a root on_chain_end updates state, the first subgraph boundary reads the still-prepared latestRootStateValues, so AG-UI emits stale STATE_SNAPSHOTs during the subgraph. The final root snapshot repairs them, so this is P2 rather than P1, but consumers can still see a temporary rollback or act on stale state.
Please keep the ordered-root cache in sync when a root on_chain_end merges object or Command.update output, and add coverage for root on_chain_end → first subgraph event without a values chunk.
…n_end When `values` is omitted from the stream modes, the first subgraph boundary snapshots directly from the ordered root cache seeded by prepareStream. A root `on_chain_end` that merged object or `Command.update` output only updated `latestStateValues`, so the boundary emitted a stale STATE_SNAPSHOT until the final root snapshot repaired it. Merge the same on_chain_end delta into `latestRootStateValues` when the event is root-namespaced, and add coverage for `root on_chain_end -> first subgraph event` without a `values` chunk for both the object and the Command.update output shapes.
Summary
messages-tuplechunks before shared snapshot logic once events-mode streaming is active, while preserving tuple-only fallback behaviorVerification
pnpm nx run-many -t test typecheck -p @ag-ui/langgraph --skip-nx-cache— 20 test files, 779 passed, 2 existing todo; typecheck passedstream-ordering-races.test.ts— all passedpnpm nx run demo-viewer:lint --skip-nx-cache— passed@ag-ui/langgraphanddemo-viewer— passedgit diff --check— passedNo event-trace goldens were changed.