hudson/slaves/SlaveComputer.java
1. In the function setChannel there is the line(531):
offlineCause = null;
which remove the offline cause after the slave reconnect.
I don't think this is the right behaviour we expect - The offline state should remain in case it made by User / CLI.
2. line 473
We might override a user offline cause with a ChannelTermination cause. I think the right way is, again, check if there is a user / CLI cause and if so - don't change it. although I'm not sure if I don't miss anything here... (what is the expected behaviour in case that the node is offline and it disconnect from the slave...)
1. Jenkins restart is one thing, after jenkins start it calls computers.updates (afair). So something can be related in this part of code.
2. probably can be related to asynchronous actions between submitted runnable in threadPoolForRemoting (afair in this way it launches slaves) and offline marking/interruption.