Revert "Removed final demand for ambient queries"

This reverts commit e16072d35c3e9a017e5532ff2938837d283866cd.