I bet they do bluetooth signal strength to determine if the car should lock or not.
But they need a bit of a delay, so it will be "if BT signal strength drops below X dBm for Y seconds" lock the car.
The reason the signal has to drop below the threshold for Y seconds is to stop the car from locking if the signal strength drops momentarily.
Another interesting question if this is right would be.
On Keyless entry cars, the thieves use a transmitter relay...Stick one box near the house, where the key is, and one in the car, and the 2 are linked up, making the car think the key is in the car.
If i am right, i would imagine if the thief knew where your phone is at night, they would be able to get a similar setup, to fool the car into thinking that the phone was near the car.
In this case, the safest thing would be to have the bluetooth turned off when sleeping.
EDIT : Well did not take long to find someone claiming to have done a relay attack.
Vendor: Tesla, Inc. Vendor URL: Versions affected: Attack tested with vehicle software v11.0 (2022.8.2 383989fadeea) and iOS app 4.6.1-891 (3784ebe63). Systems Affected: Attack tested on Model 3. M…
research.nccgroup.com
Seems Tesla has tried mitigating this by limiting how long your phone can take to reply...A relay attack would add latency, but these guys say they have made a device that can transmit from sender to receiver in the relay so fast the car will not be able to detect that this is a relay.