Seriously, this is a royal pain. It's happened to me before for understandable reasons (like attacking a visitor who was a werecreature before he turned for example).
But this time, I had a goblin siege, and lots of elven and human visitors waiting to come in to the sealed fortress. I unsealed, and released the soldiers, and broke the siege. I watched the combat logs pretty carefully. There were no instances of hostility between visitors and fort soldiers until the siege broke. My troops retired back towards there barracks, and my civilians headed outside to clean up the mess, and next thing I know I'm being spammed by interrupted tasks, caused by "elven scholar" and "human bard" and such, and my soldiers will now attack them on sight.
This is an unrecoverable mess. In my past experience what will happen is that, for a period of time, eventually, they'll stop fighting with the visitors. But after some time passes, again for no reason I can determine, hostilities will suddenly resume. What happens then is a tavern full of my civilians, and of visitors, will break into lethal combat (this is no alchohol induced brawl, to be sure), which results in sometimes dozens of deaths, and traumatized citizens who all end up in red arrow territory, and basically tantrum spirals the fort. ARGH!!
Is there some way I can avoid these damn spontaneous hostilities, you know, other thannot ordering the attack of a known werecreature who is still in his human form and visiting (totally MY doing that), or by disallowing visitors and sealing the fortress up forever, which is just silly and no fun.
P.S. Keep in mind, I think it's related to the military activity itself, because if I wait for this siege to depart on its own, and then unseal the fortress, all of the visitors flood in and no one gets into any fights, nothing goes hostile, etc.