fix: only emit fork chip at actual divergence point

Changed last_fork.clone() to last_fork.take() in render_tree_path
for both assistant and user branches. This prevents fork_info from
propagating to every downstream message, ensuring the chip appears
only at the actual divergence point in the conversation tree.
This commit is contained in:
Cameron Cordes
2026-08-08 10:51:39 -04:00
parent 9ce7cbf3df
commit a1a2d22b5b
+6 -4
View File
@@ -2511,8 +2511,10 @@ fn render_tree_path(
std::collections::VecDeque::new();
let mut node_ids: Vec<u64> = Vec::new();
let mut fork_info: Vec<Option<ForkInfo>> = Vec::new();
// Nearest divergence seen so far, carried forward across nodes (rendered or
// not) so every message at/after a fork shows the indicator.
// Nearest divergence seen so far, carried forward across non-rendered
// nodes (e.g. tool-dispatch) so the fork is attributed to the next
// rendered message. Cleared after the first rendered message consumes it,
// so the chip appears only at the actual divergence point.
let mut last_fork: Option<ForkInfo> = None;
for node in path {
@@ -2571,7 +2573,7 @@ fn render_tree_path(
tools,
});
node_ids.push(node.id);
fork_info.push(last_fork.clone());
fork_info.push(last_fork.take());
}
"user" => {
let is_initial = user_turns_seen == 0;
@@ -2585,7 +2587,7 @@ fn render_tree_path(
tools: Vec::new(),
});
node_ids.push(node.id);
fork_info.push(last_fork.clone());
fork_info.push(last_fork.take());
}
_ => continue,
}