mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-22 07:32:25 +02:00
Two bugs in the fast-path optimisation: 1. The left-side type guard checked isinstance(BaseMessage) but not id is not None. Messages without IDs (e.g. HumanMessage(content="hi")) would skip ID assignment and return None IDs. 2. The pure-append short-circuit only checked for overlaps between right and left, not duplicates within right itself. A right list containing two messages with the same ID would bypass the slow-path deduplication and return both. Fixes: - Add left_seq[0].id is not None to the type-guard condition. - Replace the any() overlap check with a set-intersection check that also verifies len(right_id_set) == len(right_msgs) (no intra-right duplicates) before taking the fast return. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>