An "undo group" has nothing to do with a "layer group". It is a functionality used in plugins that tells gimp that all the modifications done by the script should be lumped into a single undo, so you can undo the whole script action with a single Ctrl-Z instead of a using a Ctrl-Z for each change that the script has done (which in some scripts would take ages).
Starting/ending the undo groups is part of my boilerplate code so it is always part of the code and I have no version of the code without this.
If you can reproduce the problem on a small image please attach the XCF here and I'll check it out.
But IMHO this may be just the result of something else messing with Gimp's undo stack and O-B-P is just an innocent bystander. Does the problem show on a fresh image? Do you run other scripts?
Starting/ending the undo groups is part of my boilerplate code so it is always part of the code and I have no version of the code without this.
If you can reproduce the problem on a small image please attach the XCF here and I'll check it out.
But IMHO this may be just the result of something else messing with Gimp's undo stack and O-B-P is just an innocent bystander. Does the problem show on a fresh image? Do you run other scripts?