First of all, I went to defend the Castle against the Gunners. All fine, except when they were all dead the settlers turned and started attacking me. Maybe I hit one accidentally, I thought. Reloaded, this time I went out the door to attack the Gunners, to minimise the chance of accidentally hitting a settler. We killed them all, the settlers started walking back to the Castle... then turned around and attacked me again! Fairly certain I didn't hit any of them during the Gunners fight. So I went far enough away that they stopped firing, made my way back and they were all like nothing had happened... WTF.
Secondly, and this has happened at least twice now, a "settlement is under attack" message pops up, fast travel there... no attackers. Settlers tell me they're glad I turned up when I did. Wait around a few minutes, still nothing, so fast travel somewhere else... and a message pops up about failing to defend. '___'
Then there's the time I killed all the attackers and still got told I failed it, once I'd fast travelled.
I don't get any of this, except that maybe I should (in the event of a successful defence) wait to fast travel until I've had the notification pop up.