mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-23 08:02:23 +02:00
Previously, when ensure_config was called with multiple configs (e.g.
Pregel.stream's ensure_config(self.config, config)), a later config's
configurable dict fully overwrote an earlier one. This caused values
bound via with_config({"configurable": {...}}) to be silently dropped
whenever the invoke-time config supplied any other configurable key.
Concretely, create_agent binds {configurable: {ls_agent_type: 'root'}}
via with_config, and any real invocation with a checkpointer supplies
{configurable: {thread_id: ...}} at invoke time. The bound ls_agent_type
was dropped, so no root-level runs were tagged with ls_agent_type='root'
in LangSmith.
Fix: merge the configurable dict across configs (stdlib merge_configs in
langchain_core already does this correctly; langgraph's merge_configs
helper in this same file also does this at line 109). Invoke-time values
still override bound values when keys collide.
Adds a regression test in tests/test_utils.py.