Run every order before you say it works
Before you tell the interviewer it works, run it. A strong habit is one helper that runs every test tree in every order and lists what failed. Then each change you make gets checked against all of them in one call.
run(machine_class, tree, root, order) builds the machines, starts the root and delivers until the network is quiet. It returns the root machine. Compare its count with size(tree, root), the one-machine answer.
Why does this matter so much here? Because a bug in a message protocol is usually a bug about order. The last-child shortcut from earlier, sending its answer only once, passes in fifo order on the tree 0: [1, 2], 2: [3], and counts 3 in lifo. A tree checked in one order proves very little.
The editor holds failing_orders, to write, and size. Write failing_orders(machine_class, trees, orders): run every tree in every order with run, and list the (root, order) pairs whose count is wrong. The tests supply run, so call it inside failing_orders, not at the top of the file. The tests run it on a right Machine and on two broken ones.