It sounds like you’re experiencing the window positioning “bug” that is becoming more prevalent. This issue is a fairly well-documented one, dating back at least a couple of years. Sonoma seems to have made the matter much 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 (tl;dr: it’s Apple’s API, not Keyboard Maestro):
Make sure you are up to date with the latest KM version as he implemented a workaround to mitigate the crappy Accessibility API (as can be seen in this comment).
All that being said, I often times make use of a subroutine I built sometime back to position windows. It’s not as good as the native KM actions, because those can set windows based off of calculations and percentages, but if you just need basic window manipulation it works quite well. See the link below to my post with the macro and information.