Oh dear. The game is a bit wobbly when events happen at the same time, so perhaps you unfortunately pressed the long rest button exactly as someone spotted you and combat started. I had something that sounds a bit similar once when my characters got stuck long-resting on the main map in the Underdark when I happened to start a rest at the same time as a cutscene triggered. I ended up having to reload a save from before the issue happened. I hope you have a save from not too long ago.
I figured the spot I was in was safe to rest because I've used the same position before when prepping for the fight, maybe got unlucky with sight lines at that exact moment this once. Ah well, an hour of progress isn't the worst backtrack I've had. Either way, sounds like interrupting the resting process in any situation could cause the flake out.