well there are 3 posibilities and ITS NOT a BUG
1. you did not have the allied victory option selected and you and the a.i. wer the only one left.. so the a.i. wants to win too!
2. ai saw that you are sending envoys to another player so it got pissed and desided to attack you(hide them in plasma storms and at pirate bases- pirates do not see envoys)- asteroid belts are a good spot too to hide them!
3. ai knew that you thought you were safe so it desided to spice things up (happens 20% of the time)
p.s. do not let the ai see your envoys that you send to other players! otherwise its gona think that you are just dicking arround so its gona try to kill you!