Hey, this is a known issue. Undo on files that the agent created or modified can delete the whole file instead of rolling back the changes. The bug is logged, and the team is aware.
For now, it’s best not to use Ctrl+Z or Undo All on files the agent just created. If you need to revert changes, use Restore Checkpoint from the agent message menu in chat.