Skip to content

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

test(middleware): add write instruction parameter to wrap-up middleware

Steven Enamakel97b403cf28a9
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_wrap_up_toc_budget_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_wrap_up_toc_budget_tests.rs
index 7147d403f4..0ddd06243f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_wrap_up_toc_budget_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_wrap_up_toc_budget_tests.rs
@@ -282,7 +282,7 @@ async fn wrap_up_restoration_stays_bounded_when_no_window_is_advertised() {
.map(|(a, b)| (a.as_str(), b.as_str()))
.collect();
let (_toc, restore) = split_input_allowance(0);
- let mw = FinalCallWrapUpMiddleware::new("CONCLUDE NOW", sink_with(&borrowed), restore);
+ let mw = FinalCallWrapUpMiddleware::new("CONCLUDE NOW", "WRITE NOW", sink_with(&borrowed), restore);
let mut ctx = RunContext::new(
RunConfig::new("mw-test").with_max_model_calls(2),
crate::agent::tinyagents::host::OpenHumanRunContext::new(),
@@ -362,7 +362,7 @@ async fn both_middlewares_together_stay_inside_the_no_window_allowance() {
};
// Registration order at the install site: wrap-up first, contents list after.
- FinalCallWrapUpMiddleware::new("CONCLUDE NOW", sink_with(&borrowed), restore_allowance)
+ FinalCallWrapUpMiddleware::new("CONCLUDE NOW", "WRITE NOW", sink_with(&borrowed), restore_allowance)
.before_model(&mut ctx, &(), &mut request)
.await
.unwrap();
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_wrap_up_toc_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_wrap_up_toc_tests.rs
index 77d6a65857..8f3aaa7631 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_wrap_up_toc_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_wrap_up_toc_tests.rs
@@ -152,7 +152,7 @@ fn sink_with(entries: &[(&str, &str)]) -> crate::agent::tinyagents::ToolOutcomeS
/// A run with calls left is untouched: no instruction, and the tool belt intact.
#[tokio::test]
async fn wrap_up_leaves_a_call_with_budget_remaining_alone() {
- let mw = FinalCallWrapUpMiddleware::new("CONCLUDE NOW", sink_with(&[]), 0);
+ let mw = FinalCallWrapUpMiddleware::new("CONCLUDE NOW", "WRITE NOW", sink_with(&[]), 0);
let mut ctx = RunContext::new(
RunConfig::new("mw-test").with_max_model_calls(5),
crate::agent::tinyagents::host::OpenHumanRunContext::new(),
@@ -178,7 +178,7 @@ async fn wrap_up_leaves_a_call_with_budget_remaining_alone() {
/// asking — and the wrap-up instruction is appended as the final turn.
#[tokio::test]
async fn wrap_up_withdraws_tools_and_appends_the_instruction_on_the_last_call() {
- let mw = FinalCallWrapUpMiddleware::new("CONCLUDE NOW", sink_with(&[]), 0);
+ let mw = FinalCallWrapUpMiddleware::new("CONCLUDE NOW", "WRITE NOW", sink_with(&[]), 0);
let mut ctx = RunContext::new(
RunConfig::new("mw-test").with_max_model_calls(2),
crate::agent::tinyagents::host::OpenHumanRunContext::new(),
@@ -262,7 +262,7 @@ async fn wrap_up_restores_tool_results_microcompact_cleared() {
#[tokio::test]
async fn wrap_up_does_not_rewrite_a_result_that_was_never_cleared() {
let mw =
- FinalCallWrapUpMiddleware::new("CONCLUDE NOW", sink_with(&[("call-1", "FROM SINK")]), 0);
+ FinalCallWrapUpMiddleware::new("CONCLUDE NOW", "WRITE NOW", sink_with(&[("call-1", "FROM SINK")]), 0);
let mut ctx = RunContext::new(
RunConfig::new("mw-test").with_max_model_calls(2),
crate::agent::tinyagents::host::OpenHumanRunContext::new(),