State lawmakers agree to legislation to overhaul oversight of Soldiers’ Homes