Human's aren't even allowed to do this. It has to be done clean room - this is not learning, it's copying and has been proven so.
The only implementation that would be allowed is if they had to describe the code via a specification and Codepilot was able to generate it from scratch. It does not do that - it just reorganizes stuff it's already seen, which is a copyleft violation in humans, therefore it should be for a machine created by humans.
That's for patents not for copyrights. All you need to do is make it a little different, generate until satisfied for patent safe code. Another model can also do the patent checking.
I've heard multiple stories from people who can't even look at the Linux source before they do something in their company's kernel because the act of just looking at it compromises them legally. So which is it?
Clean room implementation only happens for very special codes, like codecs or efficient matrix multmul that took billions of trials to develop with AI. Not for 2-3 lines of code snippets that do one simple thing and are already covered online in hundreds of places.
One of the canonical examples of software reverse engineering is Phoenix Technologies producing a compatible BIOS for IBM PC. They did exactly what OP described - had one person look at (public but copyrighted) IBM source and produce an extremely detailed design document, then another team went and wrote a new BIOS from scratch following that document. The issue at hand was copyright, not patents.
The only implementation that would be allowed is if they had to describe the code via a specification and Codepilot was able to generate it from scratch. It does not do that - it just reorganizes stuff it's already seen, which is a copyleft violation in humans, therefore it should be for a machine created by humans.
The code has had its license violated.