In both cases, I have to somewhat go by memory. I did, actually, provide most of what you are asking for above in a summary form. In more detail...
For case one, I edited an existing RM 4.0 app. I clicked to insert a new command. I selected the line before which to insert. I selected the actions to push a button. I decided there wasn't a button for what I wanted. I clicked cancel. I clicked cancel. It blew up.
For the second case, I created a new scene. I typed in the name. I selected a handful of color bulbs devices. I selected a lot of dimmer devices (dozens). I selected many switches (about a dozen).
I went to adjust the settings. Not sure exactly what I clicked. I wanted to turn on logging. Turn on the group indicates when any light is on. I think it was when I tried to enable metering that I blew up.
I was able to go in and get things done (but, having been burned the first time, I did more saves).
When I went back into the rule to edit it after all this, It "remembered" I was in an "insert before" edit and it came right back to that. I completed the insert and it put the new entry where I was aiming the first time.
Cancels have bitten me before. I wonder if the second error was due to "editor state" issues from the first issue.
Another thing I found. I think the reason I can't manually update the device settings in that scene is because there are too many devices to list on that page.