Not sure how to avoid such situations but i just had an infinite loop. One enemy vs one cleric, the cleric had higher healing than the enemy did damage, and enough health to survive a single hit, so the enemy would hit it, then it would heal itself...then repeat...for i have no idea how long before i noticed it. Maybe something like loop detection? ie if at the end of the enemy turn both the hero team and the enemy are in the exact same state as they were at the end of the last enemy turn...have the party flee down a level, or auto kill them or something.
Are you sure? Try refreshing the game since I fixed it