The short answer: Until it’s tight.
The longer answer: See below.
Your bicycle headset cap (or stem cap) is not a structural part of your cockpit. In fact, post installation of your headset, it’s largely cosmetic.
However, you can cause yourself issues if you try and overtighten the headset cap bolt. This may include constricting the stem-steerer stack and creating a drag on your ability to steer your bicycle, stripping your headset cap bolt or even snapping the bolt or headset cap. All are signs you’ve overtightened your headset cap and need to loosen it.
A god rule of thumb is to tighten your headset cap bolt until it is causing some friction with steering and then back it off until it’s tight enough to keep the stack neatly in place. This is typically 1/8th to 1/4 of turn.
Give your headset spacers a twist. You should not be able to move them much, if at all.
It can take a little patience in some cases. Go slowly and tighten only as much as needed. No more.
In all cases, do not over-tighten the headset cap. Remember your bicycle’s headset cap is not there to hold the bicycle together. Some people even choose to run their bicycle without one. Not that we recommend that because we think it’s a wonderful piece to customize on your bicycle, but there are animals among us.