I expected repeating command blocks on "always active" to always run in the same order after a server restart.
What actually happens is that they sometimes change order when the chunks containing them are reloaded.
Steps to reproduce:
1.
/scoreboard objectives add Test dummy
/scoreboard objectives setdisplay sidebar Test
2. IMPORTANT. Go to spawn, and move yourself a few chunks towards positive X/Z. In this general area, the chunks farther from spawn should load after the ones closer to spawn (or, at least, they did when I tested this).
3. Place 3 repeating command blocks in a row, in the same X/Y coords, in order from negative Z to positive Z, making sure that at the third one is in a different chunk than the first two.
4. Add the commands:
/scoreboard players set @a Test 1
/scoreboard players set @a Test 2
/scoreboard players set @a Test 3
5. Mark the third command block (the one in the different chunk) as always active, then the second, then the first. The sidebar should display 1 for your name.
6. Close the server and re-open it. The sidebar should now display 3 instead of 1, which means that the command blocks are running in a different order. The order should be preserved regardless of in which order the chunks are loaded.
That is not possible. If you stand close enough to load one chunk but not the other, the commands in the loaded chunks are to execute but the other command blocks simply do not exist. The game cannot know you intend to force a chunk to not execute scheduled tile ticks unless another chunk is loaded (and would affect all tile entities as a result, not just command blocks). In your case, that's the state the chunks exist as until the next chunk is loaded, even if you're standing close enough to load both. One must always be loaded before the other (which will usually be dependent on your location, but is also not guaranteed).
Order of execution with Repeating and Impulse blocks is not guaranteed (MC-90376), much in the same way that
/fill
clocks cannot be relied upon as they rely on block update order (MC-11193), which also is not guaranteed to remain the same.Chain blocks were implemented for these purposes as they guarantee activation order outside of block update order. You can use them to queue order-dependent clocks so that chunk reloading does not permanently change the order of execution, or you should keep order-sensitive clocks in the same chunk. A master clock will not fix chunk-based issues if only one of the chunks is loaded, which is why command mechanisms should only be placed in the spawn chunks.