A technique I often use in this is to leave a "human in the loop". Have control points where the system takes no further action until an administrator requests it. Instead of coding that automated cleanup routine, send a notification to an admin and let them take care of it manually.
As the system matures and the edge cases become better understood it can become more automated. At first, though, leave it loose and human-powered wherever you can.