The autoattack bug starts in "combat.gd" on line 1011 "yield(self, 'skillplayed')" in enemyturn().
Yield is a coroutine command which pauses code execution, runs the first argument(combat.gd object in this case, not sure, but probably just resumes updates), and resumes when the second argument is given as a signal. The 'skillplayed' signal is given near the end of useskills(), but after checking if the player has won. Thus if the player wins during autoattack, then the current attack execution is paused until a skill(attack is a skill) finishes in the next battle. The double attack is the completion on the previous battle's unfinished attack cycle.
A proper fix would be probably be a comprehensive re-write, but a quick fix is possible. First, add "if period != 'enemyturn':" before "endcombatcheck()" in useskills(), line 917, and add a tab before the next 5 lines. Second, after the yield add "if endcombatcheck() != 'continue':" with "break" on next line (with one more tab before it). Though this change allows updates once more for any combatants still in fight. Adding the complete 5 line endcombatcheck from useskills() before "for i in enemygroup + playergroup:"(just below the yield), with "return" after "playerwin()" should prevent the additional update. I've verified that this works for some basic combat.