Thanks to everyone for your advice and suggestions! I just wanted to let you know how it turned out.
I had a plan of action prepared, based on pulling together several ideas in the thread:
1. I would start by asking the group for a detailed description of what they were doing.
2. After 1d4 hours (I rolled a 3), the previous shift would come to the barracks to sleep.
3. If the door was barricaded, they'd try to break it open. This would give the PCs time to escape out the other door--which would take them into more dangerous territory, so it might be a case of "out of the frying pan..."
4. If the door was open, the returning hobgoblins/bugbears (you're right,
MonsterEnvy!) would take one look at the PCs and shut the door again. They would then send one of the group to alert the Black Spider while they prepared to attack from the hall. Again, this would give the PCs a little time to get out the other door--but if not, I figured, let them be on the receiving end of their own "stand in the doorway and use ranged attacks" technique for a change!
5. I would try to take the PCs alive so they could be delivered to the Black Spider.
As it turned out, though, the plans were unnecessary. I said we'd pick up as they were getting ready for bed and started asking for details about their preparations for the night. The paladin's player said, "Oh, I already marked all my spells as refreshed." I said she shouldn't have done that, as it wasn't guaranteed they could get an uninterrupted long rest where they were now. They then said "Okay, we go back to the storeroom we saw earlier and sleep there instead."
No, you're not. After reading you post, I'd say you know exactly what to do. You know what should happen next. You just don't want to because you'll have some rather upset players on your hands.
I should have said I didn't know
how to do what I felt needed to be done. I wanted to be sure to handle it in a way that was fair to the players but also not too easy on them.