The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(tinyagents): render no rows when the share cannot hold one
sanil-23cb9e7c0f267f
diff --git a/src/openhuman/agent/tinyagents/middleware_part_06.rs b/src/openhuman/agent/tinyagents/middleware_part_06.rsindex b79f78bfe5..4a69a806ae 100644--- a/src/openhuman/agent/tinyagents/middleware_part_06.rs+++ b/src/openhuman/agent/tinyagents/middleware_part_06.rs@@ -480,7 +480,14 @@ impl Middleware<()> for ArtifactIndexTocMiddleware {}kept += 1;}- rows.truncate(kept.max(1));+ // No `max(1)`: once `used` is seeded with the fixed text, a share+ // smaller than that text leaves `kept == 0`, and forcing a row then+ // puts the whole message over a bound nothing downstream can shrink+ // — this is a system message, so compression keeps it and the trim+ // never evicts it, and the overshoot is charged against the+ // transcript instead (CodeRabbit on #6068). The header and the+ // omitted count still say the results exist and how to ask for one.+ rows.truncate(kept);}let shown = rows.len();let omitted = total - shown;diff --git a/src/openhuman/agent/tinyagents/middleware_tests_part_03_tests.rs b/src/openhuman/agent/tinyagents/middleware_tests_part_03_tests.rsindex 35d2f5b2f0..fc1633e44e 100644--- a/src/openhuman/agent/tinyagents/middleware_tests_part_03_tests.rs+++ b/src/openhuman/agent/tinyagents/middleware_tests_part_03_tests.rs@@ -682,3 +682,50 @@ async fn both_middlewares_together_stay_inside_the_no_window_allowance() {"the contents list is absent, so the bound proves nothing");}++/// A share smaller than the fixed text renders no rows at all. Forcing one+/// would push a message nothing downstream can shrink over its bound, and the+/// header plus the omitted count already disclose that the results exist+/// (CodeRabbit on #6068).+#[tokio::test]+async fn a_share_smaller_than_the_header_renders_no_rows() {+ let entries: Vec<(String, String, String, u64)> = (0..10)+ .map(|i| {+ (+ format!("call-{i}"),+ "file_read".to_string(),+ format!("outputs/artifact-{i}.json"),+ 1_000,+ )+ })+ .collect();+ let borrowed: Vec<(&str, &str, &str, u64)> = entries+ .iter()+ .map(|(a, b, c, d)| (a.as_str(), b.as_str(), c.as_str(), *d))+ .collect();+ let mut ctx = ctx_with_artifacts(&borrowed).await;+ // The floor a small window gets — below the header's own cost.+ let mw = ArtifactIndexTocMiddleware::new(64);+ let mut request = ModelRequest {+ messages: vec![TaMessage::user("what did you find?")],+ ..Default::default()+ };++ mw.before_model(&mut ctx, &(), &mut request).await.unwrap();++ let text = request.messages.last().expect("a contents list").text();+ assert!(+ !text.contains("file_read"),+ "no row fits the share, so none may be forced: {text}"+ );+ assert!(+ text.contains("10 more stored result(s) not listed here"),+ "every result was omitted and that must be disclosed: {text}"+ );+ // Nothing beyond the fixed text was spent.+ assert!(+ estimate_text_tokens(&text) < 64 + FOOTER_ALLOWANCE + 64,+ "the message must carry the fixed text and nothing more: {}",+ estimate_text_tokens(&text)+ );+}