Had a similar problem (gears replaced, wiring harness OK, connector good, not binding or hitting anything, etc.)
Took the the entire assembly out, had someone turn the light switch on and off and sure enough it would stop working when I would tilt it up and down, at the approximate angle of the hood movement.
Everything looked fine internally, but I did notice that the housing was hairline cracked, so I replace it with a rebuilt unit. No problems since.
Maybe the extra strain when being raised up caused things to get in a bind due to the cracked housing.
WATCH WHERE YOUR FINGERS ARE WHEN YOU ARE HOLDING IT FOR TESTING-'CAUSE IT CAN GET YOU.