I have a setup where trains are dedicated to one resource. E.g. A train will have orders:
"Iron pickup" (full load)
"Iron dropoff" (empty load)
The pickup station has no limits - the trains will idle here while waiting to fill.
The dropoff station uses a combinator and signal to set the train limit to 0 or 1. This ensures trains only go to unloading stations that actualy need the product. So when I am overproducing a resources, the train will sit, full, at the pickup station. The dropoff station will have a limit of 0 because it doesnt need more of the product (yet), waiting for a dropoff station to become available when it sets the train limit to 1.
The problem I have is when upgrading trains, the temporary upgrade stop is added between the pickup and dropoff order. The full train now leaves the picup station and goes to the upgrade station, and upgrades. However, it now gets stuck in the upgrade station, because the next order is to an unloading station which still has a limit of 0.
I had a similar issue with https://mods.factorio.com/mod/FuelTrainStop, but I discovered that mod has a setting that allows you to choose whether to insert the "fuel order" (equivalent to the upgrade order) before or after the current order. It defaults to after, which caused the same problem. I swapped the setting to "before" and now my auto fuelling works perfectly - the train refuels and then goes back to what it was doing (waiting at pickup).
Maybe a similar option could be added to this mod, or maybe you can suggest another solution?