AppleScript and Shell Script timeout issues

I am using Keyboard Maestro to control a headless Mac Mini. I utilize a macro to capture screenshots for debugging issues after the fact. I also use an AppleScript to reset the screen resolution periodically using display menu. Recently there have been issues with macros not executing properly or as expected. When I open the debugging screen every macro is stalled on either "Execute Shell Script" or "Execute AppleScript"

Could this be an issue with the engine or a problem with my Mac? The Mac Mini is running Mac OS Sonoma 14.6.1

Script timeout

Have you checked the amount free RAM? When was the last time you rebooted it?

I reboot my Mac daily (usually) because some macOS processes and other apps (Safari, "replayd", KM Engine, etc.) seem to grow indefinitely in the amount of RAM consumed.

What happens if you run these macros while connected over screen sharing? Are there any "XXX would die to control..." dialogs popping up (they may be behind other windows)? Can you post one of the macros, perhaps the resolution reset?

it's a 3.2 GHz 6 core i7 with 32GB of RAM. I rebooted it last night and it's still having the same issues. The memory is showing 13.89 GB used (of 32.00GB)

I manually set the resoltuion to 1680x1050, and then manually fired the macro. The resolution did change, but the macro still shows in the debugger as running.

Resolution set to 1680x1050:
script II

Then ran the macro show above;
script 3

and the resolution changed:
script 4

In this scenario, it's a single action macro. where the other ones, I'm taking a screenshot before or after a "move mouse" or "click at image center" so I can follow the flow or see the status after the fact. then if the screenshot shell script action gets hung up, it can't keep executing the rest of the Macro.