Orphans are attached to the root, not dropped. A node whose parent is missing — because the
depth cap truncated it, or because a row was filtered by permissions — still represents work that
happened. Dropping it would silently shrink the run; surfacing it at the top is visibly odd, which
is the correct amount of alarming.
Sorting is by Sequence alone, and the sort is stable, so siblings that tie keep the order the
query returned them in. That order is not arbitrary: GetAgentRunTree orders by started-ness,
start time and creation, precisely so a run reads in the order things happened.
It used to tie-break on NodeID, for determinism. It was deterministic and it was wrong — every
task in a graph carries the same Sequence, so EVERY workflow's steps were ordered by GUID,
throwing away the query's ordering entirely. A four-step workflow listed its first step last, and
because a GUID order is perfectly stable, it looked like a deliberate order rather than a bug.
Input order is equally deterministic — the query's ORDER BY is total — and it is also correct.
Assembles flat rows into a tree.
Orphans are attached to the root, not dropped. A node whose parent is missing — because the depth cap truncated it, or because a row was filtered by permissions — still represents work that happened. Dropping it would silently shrink the run; surfacing it at the top is visibly odd, which is the correct amount of alarming.
Sorting is by
Sequencealone, and the sort is stable, so siblings that tie keep the order the query returned them in. That order is not arbitrary:GetAgentRunTreeorders by started-ness, start time and creation, precisely so a run reads in the order things happened.It used to tie-break on
NodeID, for determinism. It was deterministic and it was wrong — every task in a graph carries the sameSequence, so EVERY workflow's steps were ordered by GUID, throwing away the query's ordering entirely. A four-step workflow listed its first step last, and because a GUID order is perfectly stable, it looked like a deliberate order rather than a bug. Input order is equally deterministic — the query'sORDER BYis total — and it is also correct.