There's actually no "tree", in reality we describe the thread structure in lightweight tuples of {thread_id, branch_id, message_id} that we can cheaply clone for each branch, and then we have another table that marks which nodes are adjacent to form the "tree". The actual message contents is stored away on its own table, so that when we clone a branch it still refers to the same data.
Abstractly, it's more like we store individual threads for each branch, then have little "bridges" at specific nodes where branching is allowed to occur, to hop between the different views.
Doing this bookkeeping upfront allows for selecting any path in the tree with an extremely dumb SELECT messages.* FROM ... WHERE thread_id = $1 AND branch_id = $2 without any kind of nasty recursion or complicated graph code.
Fun database facts aside: Yes, we can add "cost of history up to this message" to the infobox; that will go live in our next update. At a later point, we will also add "entire thread" (e.g. all branches) stats.