Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(tokenjuice): tighten preview ordering assertion in round-trip test

Steven Enamakel92f746eb51c8
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
index 151953d903..088dc80963 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools_tests.rs
@@ -103,9 +103,20 @@ async fn handle_round_trip_find_summarize_and_extract() {
// The model sees a small preview naming the handle and the tools.
assert!(preview.len() < content.len() / 4);
assert!(preview.contains(&handle));
- for name in REPL_TOOL_NAMES {
+ // It names the slice read and the outline, then the whole-original
+ // retrieve last; `juice_extract` (HTML/Markdown only) is left to its
+ // description.
+ for name in ["juice_find", "juice_summarize"] {
assert!(preview.contains(name), "footer must name {name}");
}
+ let find = preview.find("juice_find").unwrap();
+ let retrieve = preview
+ .find(crate::inference::tokenjuice::RETRIEVE_TOOL_NAME)
+ .expect("footer names the whole-original retrieve");
+ assert!(
+ find < retrieve,
+ "slice read before whole original: {preview}"
+ );
assert!(
!preview.contains("needle in the middle"),
"the needle must be behind the handle, not in the preview"