File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,7 +236,12 @@ async def prepare_stream( # pylint: disable=too-many-arguments
236236 actions = actions ,
237237 agent_name = self .name
238238 )
239- current_graph_state .update (state )
239+ # Only update graph state with keys that merge_state explicitly produced,
240+ # not keys that were simply passed through from state_input unchanged.
241+ # This preserves graph-owned state keys that the frontend may have sent stale values for.
242+ for key , value in state .items ():
243+ if key not in state_input or value is not state_input .get (key ):
244+ current_graph_state [key ] = value
240245 lg_interrupt_meta_event = next ((ev for ev in (meta_events or []) if ev .get ("name" ) == "LangGraphInterruptEvent" ), None )
241246 has_active_interrupts = active_interrupts is not None and len (active_interrupts ) > 0
242247
You can’t perform that action at this time.
0 commit comments