It just gets worse as your codebase grows with more code and more files especially. It's like a human developer who is under intense time pressure. If the codebase is large, it might miss an existing function and implement a second one... or it might miss the fact that a database table already exists to solve its current problem and create another one. The solution is to keep the codebase as simple and small as possible and name everything as intuitively as possible with proper separation of concerns. Same principles which were useful before AI are still useful with AI.
I don’t understand how it will ever overcome something like not replicating an existing function. It can’t possibly have full context on a massive codebase at all times so additional prompt runs checking for existing functionality would be necessary.
Even scarier is something like a legacy change made for a specific client, like “our biggest client needs checkboxes as the UI, do not switch it to a dropdown.” was in a commit message 2 years ago, AI will just overwrite that without thinking.