Skip to content

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

test(tools): bound one call and name the failure the other is for\n\nThe image case measured elapsed time after awaiting, so a call that never\nsettled hung the run instead of failing it, and the threshold itself was a\nflake on a loaded machine. The curl case resolved a hostname before reaching\nthe step under test, so a blocked resolver satisfied its assertion without\nthe destination directory ever being attempted.\n

oxoxDevc8489036e595
diff --git a/src/openhuman/tools/impl/browser/image_info_tests.rs b/src/openhuman/tools/impl/browser/image_info_tests.rs
index 6f9577c58c..0b2dbb7b9d 100644
--- a/src/openhuman/tools/impl/browser/image_info_tests.rs
+++ b/src/openhuman/tools/impl/browser/image_info_tests.rs
@@ -258,15 +258,13 @@ async fn execute_reports_a_bomb_shaped_header_without_decoding_pixels() {
tokio::fs::write(&png_path, &bytes).await.unwrap();
let tool = ImageInfoTool::new(test_security());
- let start = std::time::Instant::now();
- let result = tool
- .execute(json!({"path": png_path.to_string_lossy()}))
- .await
- .unwrap();
- assert!(
- start.elapsed() < std::time::Duration::from_secs(2),
- "a 34-byte file must resolve immediately regardless of claimed dimensions"
- );
+ let result = tokio::time::timeout(
+ std::time::Duration::from_secs(2),
+ tool.execute(json!({"path": png_path.to_string_lossy()})),
+ )
+ .await
+ .expect("image-info execution must settle within two seconds")
+ .unwrap();
assert!(!result.is_error, "{}", result.output());
assert!(result.output().contains("Dimensions: 60000x60000"));
diff --git a/src/openhuman/tools/impl/network/curl_tests.rs b/src/openhuman/tools/impl/network/curl_tests.rs
index 1ef1b34af4..9cc232d913 100644
--- a/src/openhuman/tools/impl/network/curl_tests.rs
+++ b/src/openhuman/tools/impl/network/curl_tests.rs
@@ -229,14 +229,17 @@ async fn execute_rejects_allowlist_miss() {
/// The downloads root cannot be created (a plain file already occupies its
/// path) — `create_dir_all` must be reported as a tool error, never a panic,
-/// and no network request is attempted before that check runs.
+/// and no network request is attempted before that check runs. The URL uses
+/// a public IPv4 literal (never actually contacted — `create_dir_all` fails
+/// and returns before any HTTP client is built) so `validate_url_with_dns_check`
+/// takes its IP-literal short-circuit and this test needs no live DNS.
#[tokio::test]
async fn execute_reports_a_create_dir_all_failure_rather_than_panicking() {
let tmp = TempDir::new().unwrap();
std::fs::write(tmp.path().join("downloads"), b"not a directory").unwrap();
- let t = tool(&tmp, vec!["example.com"]);
+ let t = tool(&tmp, vec!["8.8.8.8"]);
let result = t
- .execute(serde_json::json!({"url": "https://example.com/x", "dest_path": "sub/file.txt"}))
+ .execute(serde_json::json!({"url": "https://8.8.8.8/x", "dest_path": "sub/file.txt"}))
.await
.unwrap();
assert!(
@@ -244,4 +247,11 @@ async fn execute_reports_a_create_dir_all_failure_rather_than_panicking() {
"an unwritable downloads root must be reported, not panic: {}",
result.output()
);
+ assert!(
+ result
+ .output()
+ .contains("Failed to create destination directory"),
+ "must fail at the create_dir_all step specifically, not e.g. DNS resolution: {}",
+ result.output()
+ );
}