[PR #6316] fix(langgraph): dont persist UntrackedValue #4974

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

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

State: closed
Merged: Yes


UntrackedValue is a special channel type where the values in it are not persisted to memory. Our v1 create_agent middleware used UntrackedValue in middleware (e.g. ShellToolMiddleware) for some cool features like temp files.

If a user has elected to use a checkpointer, we normally enforce that the values they write to channels are serializable. However, this doesn't make sense to enforce for UntrackedValues because the contract is they're never written to checkpoint - so the user should not be forced to make the contents of the channel serializable

However when using a checkpointer and durability sync/async, we found that writes would still be persisted that contained UntrackedValue contents in two forms:
a) UntrackedValue channel objects
b) Send objects - in the state passed to another node

Patched this in put_writes by a) skipping persisting writes to UntrackedValue channels altogether and b) popping all UntrackedValue kv pairs nested within Send packets. We also need to sanitize in _put_checkpoint which is called when durability=="exit".

Added a basic test for UntrackedValue in test_channel.py and added more comprehensive tests using Send under some different scenarios in test_pregel.py

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6316 **State:** closed **Merged:** Yes --- UntrackedValue is a special channel type where the values in it are not persisted to memory. Our v1 create_agent middleware used UntrackedValue in middleware (e.g. ShellToolMiddleware) for some cool features like temp files. If a user has elected to use a checkpointer, we normally enforce that the values they write to channels are serializable. However, this doesn't make sense to enforce for UntrackedValues because the contract is they're never written to checkpoint - so the user should not be forced to make the contents of the channel serializable However when using a checkpointer and durability sync/async, we found that writes would still be persisted that contained UntrackedValue contents in two forms: a) UntrackedValue channel objects b) Send objects - in the state passed to another node Patched this in put_writes by a) skipping persisting writes to UntrackedValue channels altogether and b) popping all UntrackedValue kv pairs nested within Send packets. We also need to sanitize in _put_checkpoint which is called when durability=="exit". Added a basic test for UntrackedValue in test_channel.py and added more comprehensive tests using Send under some different scenarios in test_pregel.py
yindo added the pull-request label 2026-02-20 17:51:02 -05:00
yindo closed this issue 2026-02-20 17:51:02 -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#4974