Suppose that Stalin has an epiphany or a flash of insight or something and pulls his head out of his ass where it was firmly lodged right up to June 22nd 1941. He knew about the German build-up on his borders. The British had warned him months before and the Swedes had even given him the exact date. Suppose he acts on this instead of ignoring this intelligence out of paranoia or some irrational fear like in OTL.
He knew his army was far from ready for war due to a reorganization and because it was reeling from the purges. Suppose he orders them to fall back to the Stalin Line and leave Poland relatively undefended (except for border guards and troop meant for stalling efforts). Although the Red Army was in a bad state, many millions could be saved by this and not all of the Red Air Force would be taken by surprise. Instead they would be in the air over the Stalin Line. Now, the Stalin Line was a line of bunkers, trenchesm barbed wire, fortifications etc. like the Maginot Line although not quite as extensive.
Is it possible that, with the Red Army dug in in the Stalin Line and the Red Air Force not devastated and scattered on the ground in the initial stages, that the Soviets might do better, possibly preventing some of their worse defeats, perhaps even bloodying Hitler's nose a bit in some sort of Pyrrhic German victory?