fix NaN panics and eliminate redundant graph rebuilds

- All partial_cmp().unwrap() → unwrap_or(Ordering::Equal) to prevent
  NaN panics in sort operations across neuro.rs, graph.rs, similarity.rs
- replay_queue_with_graph: accepts pre-built graph, avoids rebuilding
  in agent_prompt (was building 2-3x per prompt)
- differentiate_hub_with_graph: same pattern for differentiation
- Simplify double-reverse history iteration to slice indexing

Co-Authored-By: ProofOfConcept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-03-01 00:33:53 -05:00
parent 4530837057
commit 59cfa2959f
2 changed files with 4 additions and 4 deletions

View file

@ -100,7 +100,7 @@ pub fn pairwise_similar(
}
}
results.sort_by(|a, b| b.2.partial_cmp(&a.2).unwrap());
results.sort_by(|a, b| b.2.partial_cmp(&a.2).unwrap_or(std::cmp::Ordering::Equal));
results
}