State fields are not persisted if of type number and the value is 0 (MemorySaver) #258

Closed
opened 2026-02-15 18:15:08 -05:00 by yindo · 1 comment
Owner

Originally created by @roshcagra on GitHub (May 13, 2025).

This is a rough replication of my graph:

const StateAnnotation = Annotation.Root({
  ...MessagesAnnotation.spec,
  numberField: Annotation<number>,
});

const builder = new StateGraph(StateAnnotation)
  .addNode(...)
  .addNode(...)
  .addEdge(...)
  .addEdge(...);

const checkpointer = new MemorySaver();

const graph = builder.compile({ checkpointer });

await graph.stream(
    {
      numberField: 0,
    },
    {
      configurable: {
        thread_id: "local_testing_id",
      },
    },
  )

If numberField is set to 0 by the end of a graph.stream(...), it is not persisted into the memory. My guess is that there's some sort of filter being applied by the memory saver that filters out nullish values?

Originally created by @roshcagra on GitHub (May 13, 2025). This is a rough replication of my graph: ``` const StateAnnotation = Annotation.Root({ ...MessagesAnnotation.spec, numberField: Annotation<number>, }); const builder = new StateGraph(StateAnnotation) .addNode(...) .addNode(...) .addEdge(...) .addEdge(...); const checkpointer = new MemorySaver(); const graph = builder.compile({ checkpointer }); await graph.stream( { numberField: 0, }, { configurable: { thread_id: "local_testing_id", }, }, ) ``` If `numberField` is set to `0` by the end of a `graph.stream(...)`, it is not persisted into the memory. My guess is that there's some sort of filter being applied by the memory saver that filters out nullish values?
yindo closed this issue 2026-02-15 18:15:08 -05:00
Author
Owner

@dqbd commented on GitHub (May 19, 2025):

Thank you for the report! Will look into fixing this

@dqbd commented on GitHub (May 19, 2025): Thank you for the report! Will look into fixing this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#258