Even in normal human-written code, it's not guaranteed to get the code completely correct in one-shot. That's why code review and QA still exists.
The issue here is more organizational with the engineers not getting the code up to standards before handing off, not the capabilities of the AI itself.