The undo action should be able to handle slots other than the main slot. However, since undo is handled by EditPage, and EditPage currently only supports the main slot, the best we can do for now is to fail gracefully when asked to undo an edit of something other than the main slot.
At the very least, undo needs to fail with a meaningful error message when a user user tries to undo an edit that changed a slot other than the main slot. However, it should be simple enough to make the current logic work for slots other than then main slot.
For the purpose of the baseline defined by this task, action=undo should fail with a meaningful error message when being applied to edits that touch multiple slots. However, eEventually it should become able to handle multiple slots at once (when they are edit atomically, or when the edit spans multiple edits which changed different slots), see {T189808}.