The window manipulation issue is a fairly well-documented one, dating back at least a couple of years. Sonoma seems to have made the matter worse however.
- Window resize works inconsistently (dependent on App and Mac) - Questions & Suggestions - Keyboard Maestro Discourse
- Possible Bug: Manipulate a Window Interacts Differently (And Unreliably) With Different Applications - Questions & Suggestions - Keyboard Maestro Discourse
- Getting Started with macOS Shortcuts - Questions & Suggestions - Keyboard Maestro Discourse
Anyhoo, note Peter's comments on one particular post:
Make sure you are up to date with the latest KM version as he implemented a workaround to mitigate the crappy Accessibility API (which is posted somewhere else on the forum but I can’t find it right now).