From d877ea479b9ff879abb98e046b4ef866c5cf8d9c Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 25 Jun 2025 08:38:20 -0700 Subject: [PATCH] Remove unused branch in update_state - update_state(None, as_node=None) was not tested/used, and was too similar in behavior to __copy__ / __end__, so removing it --- libs/langgraph/langgraph/pregel/__init__.py | 44 --------------------- 1 file changed, 44 deletions(-) diff --git a/libs/langgraph/langgraph/pregel/__init__.py b/libs/langgraph/langgraph/pregel/__init__.py index 2f9ca1425..465b29167 100644 --- a/libs/langgraph/langgraph/pregel/__init__.py +++ b/libs/langgraph/langgraph/pregel/__init__.py @@ -1490,28 +1490,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou return patch_checkpoint_map( next_config, saved.metadata if saved else None ) - # no values, empty checkpoint - if values is None and as_node is None: - if len(updates) > 1: - raise InvalidUpdateError( - "Cannot create empty checkpoint with multiple updates" - ) - - next_checkpoint = create_checkpoint(checkpoint, None, step) - # copy checkpoint - next_config = checkpointer.put( - checkpoint_config, - next_checkpoint, - { - "source": "update", - "step": step + 1, - "parents": saved.metadata.get("parents", {}) if saved else {}, - }, - {}, - ) - return patch_checkpoint_map( - next_config, saved.metadata if saved else None - ) # act as an input if as_node == INPUT: @@ -1906,28 +1884,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou return patch_checkpoint_map( next_config, saved.metadata if saved else None ) - # no values, empty checkpoint - if values is None and as_node is None: - if len(updates) > 1: - raise InvalidUpdateError( - "Cannot create empty checkpoint with multiple updates" - ) - - next_checkpoint = create_checkpoint(checkpoint, None, step) - # copy checkpoint - next_config = await checkpointer.aput( - checkpoint_config, - next_checkpoint, - { - "source": "update", - "step": step + 1, - "parents": saved.metadata.get("parents", {}) if saved else {}, - }, - {}, - ) - return patch_checkpoint_map( - next_config, saved.metadata if saved else None - ) # act as an input if as_node == INPUT: