They retreat after the end of the recovery tick for the conflict.Another one : Last week, a faction invaded (8th one) one of my controlled systems, lauching a war with another (non-native) faction. The invading faction lost the war (0-2) which ended last tick. They're still in. I thought they should retreat (maybe not) immediately ?
Tick A: 0-1, war active
Tick B: 0-2, war ended
Tick C: faction is gone
Same as for a normal retreat - the outcome is decided at the start of the final tick, but the faction doesn't actually disappear until the end of it.