There is a situation where dying results in an endless ghost loop. Here is how I noticed it:
1. Character dies in a dungeon and automatically respawns at the nearest outside graveyard (respawn with corpse, not ghost, because the game knows that particular dungeon/location is impossible to get to with ghost form and you do not get a flying-mount ghost form like in other zones).
2. Another player kills the character right there at the graveyard on respawn.
3. The result is the character is now at the graveyard again, but in ghost form and it automatically has the prompt to 'Resurrect now?'
4. Instead of clicking 'Accept', the bot will start walking the ghost in the direction of the dungeon (where I assume it remembers the corpse position being), but it will never be able to get there.
Suggested fix: When the character is in ghost form, check for the 'Resurrect now?' pop-up and put the character into the 'Finding secure location to resurrect' state.
It seems in this edge case that it needs to be forced into the 'finding secure spot for resurrection' routine, so that it may actually resurrect. I think prompting this forced state whenever the 'Resurrect now?' pop-up shows is a good solution, as it won't interfere with regular ghost walking and deaths.