Code sampling- The bot identifies code from appropriate languages. It then snips out logical components of the code, such as a routine or function. It then produces multiple copies of itself that includes the new code in various positions. If the bot passes a self test of core functionality with the new code, then the new code is included in future iterations. Of course, overwhelmingly the new code will break the bot. Just as most mutations are not advantageous to organisms.
The other bits you listed are doable; the above one is highly difficult without some form of human interaction. "identifies code" that it thinks it can use to improve itself is far beyond Narrow AI. And, you cannot really do effective
genetic algorithms without many thousands or billions of iterations.
I'd say code changes need human reviewers (c.f. mechanical turk) as well as automated testing and verification by the bot itself... and the issue of whether or not code changes at all, and who gets to see what part of the bot code to decide this, is difficult.
Been thinking about this problem for years... I have been focusing on design of
a "cell", trying to decide what the software running on a single node should look like. A "cell" is a single automaton running on a single CPU core, which performs a small, well-defined role in support of The Digital Organism. Some cells collectively form the brain (encrypted, distribution storage of bot source code and metadata), other cells cooperate to create the desired service (StorJ == customer data storage), etc.
To be concrete, it might look like a
bytecode engine, and a very basic
firmware that rotates through a list of high level goals. Bytecode engine may look quite a bit like
Parrot VM: may execute any programmatic script, and includes necessary built-in capabilities (file i/o, network i/o, and encryption) that permit bot bootstrapping and basic cell-to-cell communication.