This could be a large and varied subject so I will restrict it to the 20th century and give two instances.
In Sept 39, after Poland was invaded, the British diplomat in Berlin handed a note to the German government stating that if they, the Germans, did not cease hostilities against Poland a state of war would exist and a deadline was given. So post that deadline the countries were at war and so the diplomats were, I suppose, enemy belligerents. What happened to them and indeed the German diplomats in the UK? I presume they were allowed to pack up and leave?
The second case is the Japanese delegation which was translating the Japanese demands which were a virtual declaration of war but because of lack of staff etc. they failed to deliver the note until Pearl Harbour and a de-facto declaration of war had been made. Again, here I presume they were allowed to pack up and leave, but as the diplomatic niceties had not been adhered to there could have been problems.
I presume that there were rules and that also the two side acted rather like hostages for the others. In this case I suppose timing of your diplomats leaving etc. was important?