How to set GeneratorSettings metadata?

Not sure if there’s an issue with the latest API to set/retrieve XMP, with respect to file state, I’ve also not tried out setting layer XMP (like you reported in an earlier post). But for what it’s worth, in our pipeline we’ve been using XMP for ages to attach metadata to documents. We moved to UXP a year ago at a point in time when XMP still had to be retrieved and set via batchPlay, but I can confirm that (at least doing it that way) completely follows file state and plays well with undo/redo. In fact we rely on that in our pipeline.

I would recommend giving XMP another try with a minimal example and post your code here so to better help you.

You should probably check out these posts: Document XMP metadata

And this more recent one: