When I return to YVR there has always been a passport check at the gate prior to boarding regardless of what US city I depart from. It is done at the counter and the information is checked with the information in their system, at least that's how UA does it.