In my current game I got the every currently colonized planet gets a hostile agent (mega?) event.
Whilst trying to bump all those off, got the Jagged Edge independence event and lost 3 of my planets. Being the petty individual I am, I took my planets back.
The bug is this... When I reclaimed the planet that still had an agent on, the agent was missing, no sign of decreased production (he was on an enhanced factory). But, he is still listed as being there on my domestic espionage report. Trying to nullify him gets no result.