Currently, the distinct command's behavior (with respect to whether it does shard versioning or not) is nondeterministic.
The distinct command on mongos uses ShardConnection with a namespace, but without a ChunkManager.
So, if the connection retrieved from the sharded connection pool happens to be as fresh as the mongos's routing table cache, setShardVersion will not be sent over the connection.
If the connection is staler than the mongos's routing table cache, setShardVersion will be sent over the connection, and if the mongos's routing table cache was staler than the authoritative routing table, the mongos will receive a stale version error.
Then, mongos will refresh its routing table cache and retry the distinct command, which will now get routed to the correct shard.
This ticket should make the distinct command use scatterGather() rather than ShardConnection, so that it always has versioned behavior.