Did you already try the vent height and flushness?
Vent Height Adjustment
You should cycle the sunroof module to the vent position using the drive motor. And then check the glass tilt-in height using an appropriate measuring tool. If the vent height is greater than 35mm, use the switch to slowly set to the proper height. After setting the correct height you should remove the drive motor.
And then with the motor removed, use the switch to set the tilt by operating the gear to the fully closed position. Using the tilt switch, operate the motor until it comes to a full stop at the tilt position. And then install the drive motor and verify correct operation.