I've seen it argued sometimes that Stalin was taken by surprise, dismissing reports of the German buildup to invasion as British propaganda. Yet he can hardly have been unaware of Hitler's ultimate intentions, so what could or should he have done that was different from, say the start of 1938?
One strategy that did work out OTL (after a fashion) was to ensure that Germany was at war with Britain and France first. Both he and they would have been willing to let Hitler fight the others first, and hope the result was close enough that they could profit from the result.
Which brings me to another question - is there a possible timeline where the boot is on the other foot, and Hitler launches Barbarossa with at least the acquiescence of Britain and France, if not their actual assistance?