If you swap a card as captain, and you get a sabotage, does it then have to be played immediately or is it discarded and a new card swapped because the sabotage phase has ended?
It has to be immediately resolved or the investigation fails.
Rulebook page 12:
8. REVEAL SUPPLY CARDS
The Captain reveals as many cards from the pool as instructed by the Mission Log card directive. If less than the full pool is to be revealed, the Captain flips over one card at a time, stopping once the directive has been fulfilled or the requisite number of cards have been revealed.
If a Sabotage card is revealed, (added after the Captain swapped a Supply card) it must be resolved immediately or the investigation fails.
When directed to roll, the Dice Value of the pool is totaled. The Captain rolls those dice (to a maximum of 6) then compares the result to the requirement on the Mission Log.