Move knowledge_graph_inst.has_node check inside get_storage_keyed_lock in _merge_edges_then_upsert to ensure atomic check-then-act operations and prevent duplicate node creation during concurrent updates.