Skip to content

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

merge: sync test ownership epic with upstream main

Steven Enamakel657a8d0e4715
diff --cc Cargo.lock
index 964b75fccb,eff047c914..e06218164b
--- a/Cargo.lock
+++ b/Cargo.lock
@@@ -45,6 -45,6 +45,16 @@@ dependencies =
"generic-array",
]
++[[package]]
++name = "aead"
++version = "0.6.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "1973cfbc1a2daf9cf550e74e1f088c28e7f7d8c1e1418fb6c9dc5184b7e84c99"
++dependencies = [
++ "crypto-common 0.2.2",
++ "inout 0.2.2",
++]
++
[[package]]
name = "aes"
version = "0.8.4"
@@@ -73,7 -73,7 +83,7 @@@ version = "0.10.3
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1"
dependencies = [
-- "aead",
++ "aead 0.5.2",
"aes 0.8.4",
"cipher 0.4.4",
"ctr 0.9.2",
@@@ -1168,6 -1168,6 +1178,7 @@@ source = "registry+https://github.com/r
checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
dependencies = [
"cfg-if",
++ "cipher 0.5.2",
"cpufeatures 0.3.1",
"rand_core 0.10.1",
]
@@@ -1178,13 -1178,13 +1189,25 @@@ version = "0.10.1
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35"
dependencies = [
-- "aead",
++ "aead 0.5.2",
"chacha20 0.9.1",
"cipher 0.4.4",
-- "poly1305",
++ "poly1305 0.8.0",
"zeroize",
]
++[[package]]
++name = "chacha20poly1305"
++version = "0.11.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9b89e1c441e926b9c82a8d023f6e1b7ae0adcfaa7d621814e4d60789bac751cb"
++dependencies = [
++ "aead 0.6.1",
++ "chacha20 0.10.2",
++ "cipher 0.5.2",
++ "poly1305 0.9.1",
++]
++
[[package]]
name = "chrono"
version = "0.4.45"
@@@ -1866,7 -1866,7 +1889,9 @@@ version = "0.2.2
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
dependencies = [
++ "getrandom 0.4.3",
"hybrid-array",
++ "rand_core 0.10.1",
]
[[package]]
@@@ -5388,7 -5388,7 +5413,7 @@@ dependencies =
"axum",
"base64 0.22.1",
"bytes",
-- "chacha20poly1305",
++ "chacha20poly1305 0.10.1",
"chrono",
"chrono-tz",
"directories",
@@@ -6253,6 -6253,6 +6278,16 @@@ dependencies =
"universal-hash 0.5.1",
]
++[[package]]
++name = "poly1305"
++version = "0.9.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6e2d0073b297041425c7c3df6eb4792d598a15323fe63346852b092eca02904c"
++dependencies = [
++ "cpufeatures 0.3.1",
++ "universal-hash 0.6.1",
++]
++
[[package]]
name = "polycool"
version = "0.4.0"
@@@ -9819,6 -9819,6 +9854,7 @@@ dependencies =
"tinystoragedrivers-bus",
"tinystoragedrivers-client",
"tinystoragedrivers-core",
++ "tinystoragedrivers-schema",
"tokio",
]
@@@ -9843,7 -9843,7 +9879,7 @@@ dependencies =
"data-encoding",
"serde",
"serde_json",
-- "sha2 0.10.9",
++ "sha2 0.11.0",
"tinystoragedrivers-schema",
"tokio",
"ulid",
@@@ -9871,7 -9871,7 +9907,7 @@@ dependencies =
"mongodb",
"serde",
"serde_json",
-- "sha2 0.10.9",
++ "sha2 0.11.0",
"tinystoragedrivers-core",
"tokio",
]
@@@ -9908,15 -9908,15 +9944,16 @@@ version = "1.0.0
dependencies = [
"async-trait",
"atomicwrites",
-- "chacha20poly1305",
++ "chacha20poly1305 0.11.0",
"clack-private-fs",
"fs4",
-- "hkdf 0.12.4",
++ "getrandom 0.4.3",
++ "hkdf 0.13.0",
"keyring",
"rustix 1.1.5",
"serde",
"serde_json",
-- "sha2 0.10.9",
++ "sha2 0.11.0",
"tinystoragedrivers-core",
"tokio",
"winapi-util",
@@@ -9931,7 -9931,7 +9968,7 @@@ version = "1.0.0
dependencies = [
"rusqlite",
"serde_json",
-- "sha2 0.10.9",
++ "sha2 0.11.0",
"tinystoragedrivers-core",
"tokio",
"zstd 0.13.3",
diff --cc crates/openhuman-app/Cargo.lock
index bdd686b636,07f9b15818..71f10d28bb
--- a/crates/openhuman-app/Cargo.lock
+++ b/crates/openhuman-app/Cargo.lock
@@@ -27,6 -27,6 +27,16 @@@ dependencies =
"generic-array",
]
++[[package]]
++name = "aead"
++version = "0.6.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "1973cfbc1a2daf9cf550e74e1f088c28e7f7d8c1e1418fb6c9dc5184b7e84c99"
++dependencies = [
++ "crypto-common 0.2.2",
++ "inout 0.2.5",
++]
++
[[package]]
name = "aes"
version = "0.8.4"
@@@ -34,7 -34,7 +44,7 @@@ source = "registry+https://github.com/r
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
dependencies = [
"cfg-if",
-- "cipher",
++ "cipher 0.4.4",
"cpufeatures 0.2.17",
]
@@@ -44,9 -44,9 +54,9 @@@ version = "0.10.3
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1"
dependencies = [
-- "aead",
++ "aead 0.5.2",
"aes",
-- "cipher",
++ "cipher 0.4.4",
"ctr",
"ghash",
"subtle",
@@@ -721,7 -721,7 +731,7 @@@ source = "registry+https://github.com/r
checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"
dependencies = [
"cfg-if",
-- "cipher",
++ "cipher 0.4.4",
"cpufeatures 0.2.17",
]
@@@ -732,6 -732,6 +742,7 @@@ source = "registry+https://github.com/r
checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
dependencies = [
"cfg-if",
++ "cipher 0.5.2",
"cpufeatures 0.3.1",
"rand_core 0.10.1",
]
@@@ -742,13 -742,13 +753,25 @@@ version = "0.10.1
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35"
dependencies = [
-- "aead",
++ "aead 0.5.2",
"chacha20 0.9.1",
-- "cipher",
-- "poly1305",
++ "cipher 0.4.4",
++ "poly1305 0.8.0",
"zeroize",
]
++[[package]]
++name = "chacha20poly1305"
++version = "0.11.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "9b89e1c441e926b9c82a8d023f6e1b7ae0adcfaa7d621814e4d60789bac751cb"
++dependencies = [
++ "aead 0.6.1",
++ "chacha20 0.10.2",
++ "cipher 0.5.2",
++ "poly1305 0.9.1",
++]
++
[[package]]
name = "chrono"
version = "0.4.45"
@@@ -780,10 -780,10 +803,21 @@@ source = "registry+https://github.com/r
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
dependencies = [
"crypto-common 0.1.7",
-- "inout",
++ "inout 0.1.4",
"zeroize",
]
++[[package]]
++name = "cipher"
++version = "0.5.2"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c"
++dependencies = [
++ "block-buffer 0.12.1",
++ "crypto-common 0.2.2",
++ "inout 0.2.5",
++]
++
[[package]]
name = "clack-private-fs"
version = "1.0.0"
@@@ -793,6 -793,6 +827,12 @@@ dependencies =
"windows-sys 0.61.2",
]
++[[package]]
++name = "cmov"
++version = "0.5.4"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a"
++
[[package]]
name = "combine"
version = "4.6.8"
@@@ -963,7 -963,7 +1003,9 @@@ version = "0.2.2
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
dependencies = [
++ "getrandom 0.4.3",
"hybrid-array",
++ "rand_core 0.10.1",
]
[[package]]
@@@ -1011,7 -1011,7 +1053,16 @@@ version = "0.9.2
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835"
dependencies = [
-- "cipher",
++ "cipher 0.4.4",
++]
++
++[[package]]
++name = "ctutils"
++version = "0.4.3"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574"
++dependencies = [
++ "cmov",
]
[[package]]
@@@ -1188,6 -1188,6 +1239,7 @@@ dependencies =
"block-buffer 0.12.1",
"const-oid",
"crypto-common 0.2.2",
++ "ctutils",
]
[[package]]
@@@ -2199,7 -2199,7 +2251,16 @@@ version = "0.12.4
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"
dependencies = [
-- "hmac",
++ "hmac 0.12.1",
++]
++
++[[package]]
++name = "hkdf"
++version = "0.13.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "4aaa26c720c68b866f2c96ef5c1264b3e6f473fe5d4ce61cd44bbe913e553018"
++dependencies = [
++ "hmac 0.13.0",
]
[[package]]
@@@ -2211,6 -2211,6 +2272,15 @@@ dependencies =
"digest 0.10.7",
]
++[[package]]
++name = "hmac"
++version = "0.13.0"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f"
++dependencies = [
++ "digest 0.11.3",
++]
++
[[package]]
name = "hostname"
version = "0.4.2"
@@@ -2551,6 -2551,6 +2621,15 @@@ dependencies =
"generic-array",
]
++[[package]]
++name = "inout"
++version = "0.2.5"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "3b5cf4372d022092674a83b8febf5865f7a573cc0c5baec5e49c879b6a20978f"
++dependencies = [
++ "hybrid-array",
++]
++
[[package]]
name = "io-extras"
version = "0.19.0"
@@@ -3680,7 -3680,7 +3759,7 @@@ dependencies =
"axum",
"base64 0.22.1",
"bytes",
-- "chacha20poly1305",
++ "chacha20poly1305 0.10.1",
"chrono",
"chrono-tz",
"directories 6.0.0",
@@@ -3691,8 -3691,8 +3770,8 @@@
"futures",
"futures-util",
"hex",
-- "hkdf",
-- "hmac",
++ "hkdf 0.12.4",
++ "hmac 0.12.1",
"hostname",
"iana-time-zone",
"libc",
@@@ -4267,7 -4267,7 +4346,17 @@@ checksum = "8159bd90725d2df49889a078b54
dependencies = [
"cpufeatures 0.2.17",
"opaque-debug",
-- "universal-hash",
++ "universal-hash 0.5.1",
++]
++
++[[package]]
++name = "poly1305"
++version = "0.9.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "6e2d0073b297041425c7c3df6eb4792d598a15323fe63346852b092eca02904c"
++dependencies = [
++ "cpufeatures 0.3.1",
++ "universal-hash 0.6.1",
]
[[package]]
@@@ -4279,7 -4279,7 +4368,7 @@@ dependencies =
"cfg-if",
"cpufeatures 0.2.17",
"opaque-debug",
-- "universal-hash",
++ "universal-hash 0.5.1",
]
[[package]]
@@@ -7123,6 -7123,6 +7212,7 @@@ dependencies =
"tinystoragedrivers-bus",
"tinystoragedrivers-client",
"tinystoragedrivers-core",
++ "tinystoragedrivers-schema",
"tokio",
]
@@@ -7147,7 -7147,7 +7237,7 @@@ dependencies =
"data-encoding",
"serde",
"serde_json",
-- "sha2 0.10.9",
++ "sha2 0.11.0",
"tinystoragedrivers-schema",
"tokio",
"ulid",
@@@ -7181,15 -7181,15 +7271,16 @@@ version = "1.0.0
dependencies = [
"async-trait",
"atomicwrites",
-- "chacha20poly1305",
++ "chacha20poly1305 0.11.0",
"clack-private-fs",
"fs4",
-- "hkdf",
++ "getrandom 0.4.3",
++ "hkdf 0.13.0",
"keyring",
"rustix 1.1.5",
"serde",
"serde_json",
-- "sha2 0.10.9",
++ "sha2 0.11.0",
"tinystoragedrivers-core",
"tokio",
"winapi-util",
@@@ -7204,7 -7204,7 +7295,7 @@@ version = "1.0.0
dependencies = [
"rusqlite",
"serde_json",
-- "sha2 0.10.9",
++ "sha2 0.11.0",
"tinystoragedrivers-core",
"tokio",
"zstd",
@@@ -7830,6 -7830,6 +7921,16 @@@ dependencies =
"subtle",
]
++[[package]]
++name = "universal-hash"
++version = "0.6.1"
++source = "registry+https://github.com/rust-lang/crates.io-index"
++checksum = "f4987bdc12753382e0bec4a65c50738ffaabc998b9cdd1f952fb5f39b0048a96"
++dependencies = [
++ "crypto-common 0.2.2",
++ "ctutils",
++]
++
[[package]]
name = "unsafe-libyaml-norway"
version = "0.2.15"
diff --cc crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
index 1729d163d5,ec1dcffa4c..f373af5651
--- a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
@@@ -148,21 -144,46 +148,81 @@@ pub(crate) fn run_policy_for_provider
)
}
+fn run_policy_for_provider_with_overrides(
+ max_iterations: usize,
+ response_cache_enabled: bool,
+ local_provider: bool,
+ tool_call_cap: Option<usize>,
+ overrides: TurnPolicyOverrides,
+) -> RunPolicy {
- run_policy(&TurnPolicyOptions {
++ run_policy_for_provider_with_overrides_and_backoff(
++ max_iterations,
++ response_cache_enabled,
++ local_provider,
++ tool_call_cap,
++ overrides,
++ None,
++ )
++}
++
+ /// [`run_policy_for_provider`] with the retry-backoff override passed in rather
+ /// than read from the process environment.
+ pub(crate) fn run_policy_for_provider_with_backoff(
+ max_iterations: usize,
+ response_cache_enabled: bool,
+ local_provider: bool,
+ tool_call_cap: Option<usize>,
+ retry_backoff_ms: Option<&str>,
++) -> RunPolicy {
++ run_policy_for_provider_with_overrides_and_backoff(
++ max_iterations,
++ response_cache_enabled,
++ local_provider,
++ tool_call_cap,
++ env_overrides(),
++ retry_backoff_ms,
++ )
++}
++
++fn run_policy_for_provider_with_overrides_and_backoff(
++ max_iterations: usize,
++ response_cache_enabled: bool,
++ local_provider: bool,
++ tool_call_cap: Option<usize>,
++ overrides: TurnPolicyOverrides,
++ retry_backoff_ms: Option<&str>,
+ ) -> RunPolicy {
+ let mut policy = run_policy(&TurnPolicyOptions {
max_model_calls: max_iterations,
max_tool_calls: tool_call_limit(max_iterations, tool_call_cap),
max_depth: MAX_SPAWN_DEPTH,
local_provider,
response_cache_enabled,
- overrides: env_overrides(),
+ overrides,
- })
+ });
+ apply_retry_backoff_override(&mut policy, retry_backoff_ms);
+ policy
+ }
+
+ /// Scale the model-call retry schedule down to `initial` milliseconds
+ /// (`OPENHUMAN_MODEL_RETRY_BACKOFF_MS`). The attempt count and the doubling
+ /// shape are kept; only the waits shrink, so suites that drive a failing
+ /// upstream do not sit through the 3/6/12/24 s production schedule. Values
+ /// above the production initial wait, as well as unset, empty, `0` or
+ /// unparsable values, leave the production schedule untouched.
+ pub(crate) fn apply_retry_backoff_override(policy: &mut RunPolicy, raw: Option<&str>) {
+ let Some(ms) = raw
+ .and_then(|v| v.trim().parse::<u64>().ok())
+ .filter(|ms| *ms > 0 && *ms <= policy.retry.initial_backoff_ms)
+ else {
+ return;
+ };
+ policy.retry.initial_backoff_ms = ms;
+ policy.retry.max_backoff_ms = ms.saturating_mul(10);
+ tracing::debug!(
+ initial_backoff_ms = ms,
+ "[turn_policy] model retry backoff overridden"
+ );
}
/// Default per-turn tool budget, narrowed by an explicit host cap.
diff --cc crates/openhuman-core/src/memory/tools.rs
index f524cf431d,92b2866be1..f7a63b494a
--- a/crates/openhuman-core/src/memory/tools.rs
+++ b/crates/openhuman-core/src/memory/tools.rs
@@@ -347,6 -349,6 +349,9 @@@ mod offline_tests
#[path = "tools_queue_failure_tests.rs"]
mod queue_failure_tests;
#[cfg(test)]
++#[path = "tools_queue_tests.rs"]
++mod queue_tests;
++#[cfg(test)]
#[path = "tools_read_tests.rs"]
mod read_tests;
#[cfg(test)]
diff --cc crates/openhuman-core/src/memory/tools_queue_tests.rs
index 0000000000,0000000000..38347f201e
new file mode 100644
--- /dev/null
+++ b/crates/openhuman-core/src/memory/tools_queue_tests.rs
@@@ -1,0 -1,0 +1,18 @@@
++use super::*;
++use crate::memory::test_fixtures::config_in;
++
++#[tokio::test]
++async fn learning_is_durably_queued_even_when_the_backend_refuses_writes() {
++ let tmp = tempfile::tempdir().unwrap();
++ let config = config_in(&tmp);
++ crate::memory::test_fixtures::RefusingEngine::out_of_credits().bind(&config);
++ let tool = MemoryTool::new(Arc::new(config.clone()));
++ let result = tool
++ .execute(json!({"action":"learn","text":"Prefers tea"}))
++ .await
++ .unwrap();
++ assert!(!result.is_error, "{}", result.text());
++ let value: Value = serde_json::from_str(&result.text()).unwrap();
++ assert_eq!(value["status"], "queued; not yet saved to memory");
++ assert_eq!(super::super::tool_writes::drain(&config).await, 0);
++}
diff --cc crates/openhuman-core/src/memory/tools_tests.rs
index 4006bfce81,b7e5d3db39..0e52532f01
--- a/crates/openhuman-core/src/memory/tools_tests.rs
+++ b/crates/openhuman-core/src/memory/tools_tests.rs
@@@ -714,19 -735,19 +735,3 @@@ async fn refers_to_reaches_the_engine_i
]
);
}
--
--#[tokio::test]
--async fn learning_is_durably_queued_even_when_the_backend_refuses_writes() {
-- let tmp = tempfile::tempdir().unwrap();
-- let config = config_in(&tmp);
-- crate::memory::test_fixtures::RefusingEngine::out_of_credits().bind(&config);
-- let tool = MemoryTool::new(Arc::new(config.clone()));
-- let result = tool
-- .execute(json!({"action":"learn","text":"Prefers tea"}))
-- .await
-- .unwrap();
-- assert!(!result.is_error, "{}", result.text());
-- let value: Value = serde_json::from_str(&result.text()).unwrap();
-- assert_eq!(value["status"], "queued; not yet saved to memory");
-- assert_eq!(super::super::tool_writes::drain(&config).await, 0);
--}
diff --cc scripts/ci/check-openhuman-rust-layout.mjs
index 0177f8b393,cd605a0a24..24a7308e09
--- a/scripts/ci/check-openhuman-rust-layout.mjs
+++ b/scripts/ci/check-openhuman-rust-layout.mjs
@@@ -37,9 -37,9 +37,9 @@@ const LEGACY_LIMIT_ENTRIES =
// their current sizes while follow-up work separates their test concerns.
// `core/` was pruned from the line limit by name until these pins; its
// oversized files are pinned at the size they had when enforcement began.
- ["crates/openhuman-core/src/core/all.rs", 1114],
+ ["crates/openhuman-core/src/core/all.rs", 1078],
["crates/openhuman-core/src/core/all_tests.rs", 1465],
- ["crates/openhuman-core/src/core/events.rs", 1697],
+ ["crates/openhuman-core/src/core/events.rs", 1649],
["crates/openhuman-core/src/core/events_tests.rs", 988],
["crates/openhuman-core/src/core/observability.rs", 3361],
];