Gmail undo is basically job cancellation, not really returning a changed state back to its original state.
Gmail can't "undo" once that job has been processed - in other words, when something has been actually done.
Gmail can't "undo" once that job has been processed - in other words, when something has been actually done.
What Google is doing is (at least for deletes on mails) is equivalent to a database transaction rollback. So they have a tiny (likely 1-entry) transaction log that they keep per user, and if the user desires, they can use it to fully reverse any operation that is undoable aka reversible.
I suppose it works different for email sends you can undo - in that case it is job cancellation.