diff --git a/src/ai/insight_chat.rs b/src/ai/insight_chat.rs index 58cce7a..88badfd 100644 --- a/src/ai/insight_chat.rs +++ b/src/ai/insight_chat.rs @@ -2511,8 +2511,10 @@ fn render_tree_path( std::collections::VecDeque::new(); let mut node_ids: Vec = Vec::new(); let mut fork_info: Vec> = 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 = None; for node in path { @@ -2571,9 +2573,9 @@ fn render_tree_path( tools, }); node_ids.push(node.id); - fork_info.push(last_fork.clone()); + fork_info.push(last_fork.take()); } - "user" => { + "user" => { let is_initial = user_turns_seen == 0; user_turns_seen += 1; pending_tools.clear(); @@ -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, }