Skip to content

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

test(middleware): remove duplicate test for unprepared summarizer

Steven Enamakel066f1aa4adff
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
index a926554e6f..e628c7364e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_compaction_tests.rs
@@ -321,43 +321,6 @@ async fn a_tool_that_did_not_declare_summary_focus_keeps_the_argument() {
assert_eq!(call.arguments, arguments);
}
-/// A summary model that cannot even set up its call.
-struct UnpreparableSummarizer;
-
-impl PayloadSummarizer for UnpreparableSummarizer {
- fn prepare(
- &self,
- _parent_ctx: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,
- ) -> anyhow::Result<crate::inference::tokenjuice::generate::PreparedGenerate> {
- anyhow::bail!("no summary model resolved")
- }
-}
-
-/// A result that qualified for a summary and did not get one says so, even
-/// when the failure is the host's and the module never ran the stage.
-#[tokio::test]
-async fn a_summary_that_could_not_be_prepared_is_disclosed() {
- let mw = summarizer_mw(Arc::new(UnpreparableSummarizer));
- let raw = "payload ".repeat(200);
- let mut result = tool_result("test_tool", &raw);
- let (outcome, requests) = with_module(mw.after_tool(
- &mut ctx(),
- &(),
- &invocation("unprepared", "test_tool"),
- &mut result,
- ))
- .await;
- outcome.unwrap();
-
- assert!(requests.iter().all(|r| r.context_token.is_none()));
- assert!(
- result_text(&result).starts_with(&crate::inference::tokenjuice::summary_failed_notice()),
- "the raw payload must be disclosed as unsummarized: {:?}",
- result_text(&result).chars().take(200).collect::<String>()
- );
- assert!(result_text(&result).ends_with(&raw));
-}
-
/// With no thread, summary reuse and the breaker are scoped to the run, one
/// scope for every result in it, rather than a fresh one per call.
#[tokio::test]
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs
index d970a1ea07..448dd8f95f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_tests.rs
@@ -113,7 +113,9 @@ async fn a_payload_that_needed_nothing_is_left_completely_alone() {
#[tokio::test]
async fn a_summary_model_that_cannot_prepare_leaves_the_payload_intact() {
// A host misconfiguration (no parent turn to bind to) must never break
- // the tool call; the module is simply not offered a summary call.
+ // the tool call; the module is simply not offered a summary call. The
+ // payload is untouched, and disclosed as unsummarized like any other
+ // failed summary, so the model does not re-run the tool for one.
struct Unpreparable;
impl PayloadSummarizer for Unpreparable {
fn prepare(
@@ -138,7 +140,9 @@ async fn a_summary_model_that_cannot_prepare_leaves_the_payload_intact() {
.0
.expect("a summarizer error must never break the tool call");
- assert_eq!(result_text(&result), "RAW-TOOL-OUTPUT");
+ let text = result_text(&result);
+ assert!(text.starts_with(&crate::inference::tokenjuice::summary_failed_notice()));
+ assert!(text.ends_with("RAW-TOOL-OUTPUT"));
}
#[tokio::test]
@@ -623,6 +627,7 @@ async fn a_tool_that_caps_itself_is_summarized_when_the_caller_gives_a_focus() {
let stub = StubSummarizer::replying(Ok("focused".into()));
let mut mw = summarizer_mw(stub.clone());
mw.tool_policies = tool_policies;
+ mw.summary_focus_tools = ["terse".to_string()].into();
let mut call = TaToolCall::new("terse-focus", "terse", json!({"summary_focus": "errors"}));
let mut ctx = ctx();
mw.before_tool(&mut ctx, &(), &mut call).await.unwrap();