Sharing my thoughts based on my experience about these types of issues we are facing in my current organisation.
There could be multiple reasons for jobs stuck via un attended mode
Mainly due to software patching make UiPath robot services unstable so jobs are stuck for long time. To solve this issue we can exclude our robot Vm from automatic software patching. Instead we can ask it team to perform manual patching on weekends or when bot is free.
Some times if you have very less memory in your c drive it might cause jobs stuck for long time pr slow running. To solve this increase the hard disk space. Or remove the unwanted software form machine.
There might be getting unknown pop ups or user intervention pop ups which could cause process can run long time - remove any such code present in the process or fix the process to get proper exceptions
Whenever you see jobs are getting stuck any VM instead of restarting the only machine try restarting all the UiPath services and after restart your Vm to permanently resolve these type of issues.
We had similar issues on our project, Bots would be stuck for good 10 odd hours. We came up with an idea of creating a bot that would notify which bot is stuck on orchestrator.
With this problem statement I created a UI Automation. Attached the flowchart for it below.