Are you using the HK magwell or the AR magwell?
If you're using the AR magwell, your bolt-hold-open will be hit and miss depending on the mags, the weather, alignment of the planets, menstrual cycle of your neighbour's wife, and other factors.
If you are using the HK mags and the HK magwell, your mags should lock back all the time unless someone fiddled with the trigger group and switched that option off. Open your trigger group, and look at the bolt-hold-open. See that ugly silver snake's head pointing out of the top front of your lower (That's the bolt-hold-open)? Follow it down until it turns black, and on the left side you should see the end of a spring. Grey, long, possibly sharp, looks like a piece of wire. Make sure that that wire is to the right, snug as close as possible to the bolt-hold-open. Preferably at the average distance between two lovers. Push the bolt-hold-open up, with your finger from the bottom while observing from the top. The wire should clear the plastic shelf that is just to the left of the bolt-hold open.
If this is correct, then you have a different problem: The bolt back with enough force to clear the bolt-hold-open and allow it time to move up. Try different ammo and lube your carrier. If there is still a problem, your mag might have a weak spring. Pull the bolt back and push the bolt-hold-open up with your fingers. If it stays open, your mags are suspect. Clean your mags, get new ones, etc. to make them push up harder.
Let us know if you still have a problem.