Merge "Make smart reply insertion logic more robust" into sc-dev