Skip to content

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

chore: files changed crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs,crates

Steven Enamakel9eb307723c0e
diff --git a/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs b/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
index 0df43fe032..4037273243 100644
--- a/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
@@ -28,15 +28,16 @@ async fn agent_registry_rpc_preserves_document_conflicts() {
.expect("agent registry RPC is registered");
let ctx = CoreContext::for_test_with_config(DomainSet::full(), stale);
let error = CoreContext::scope(ctx.clone(), async move {
- controller.invoke(
- DispatchCtx::new(ctx),
- json!({"id": "orchestrator", "enabled": true})
- .as_object()
- .unwrap()
- .clone(),
- )
- .await
- .unwrap_err()
+ controller
+ .invoke(
+ DispatchCtx::new(ctx),
+ json!({"id": "orchestrator", "enabled": true})
+ .as_object()
+ .unwrap()
+ .clone(),
+ )
+ .await
+ .unwrap_err()
})
.await;
let structured = crate::core::StructuredRpcError::decode(&error)
@@ -71,12 +72,13 @@ async fn memory_engine_rpc_preserves_document_conflicts() {
.expect("memory engine RPC is registered");
let ctx = CoreContext::for_test_with_config(DomainSet::full(), stale);
let error = CoreContext::scope(ctx.clone(), async move {
- controller.invoke(
- DispatchCtx::new(ctx),
- json!({"engine": "none"}).as_object().unwrap().clone(),
- )
- .await
- .unwrap_err()
+ controller
+ .invoke(
+ DispatchCtx::new(ctx),
+ json!({"engine": "none"}).as_object().unwrap().clone(),
+ )
+ .await
+ .unwrap_err()
})
.await;
let structured = crate::core::StructuredRpcError::decode(&error)
@@ -114,7 +116,8 @@ async fn sequential_config_rpcs_use_the_latest_context_snapshot() {
] {
let dispatch = DispatchCtx::new(ctx.clone());
CoreContext::scope(ctx.clone(), async {
- controller.invoke(dispatch, patch.as_object().unwrap().clone())
+ controller
+ .invoke(dispatch, patch.as_object().unwrap().clone())
.await
.expect(
"sequential config settings updates should use the latest context snapshot",
@@ -157,15 +160,16 @@ async fn external_config_conflict_refreshes_the_context_before_the_next_read() {
.find(|controller| controller.rpc_method_name() == "openhuman.config_update_model_settings")
.expect("config model settings RPC is registered");
let conflict = CoreContext::scope(ctx.clone(), async {
- controller.invoke(
- DispatchCtx::new(ctx.clone()),
- json!({"default_temperature": 0.8})
- .as_object()
- .unwrap()
- .clone(),
- )
- .await
- .unwrap_err()
+ controller
+ .invoke(
+ DispatchCtx::new(ctx.clone()),
+ json!({"default_temperature": 0.8})
+ .as_object()
+ .unwrap()
+ .clone(),
+ )
+ .await
+ .unwrap_err()
})
.await;
assert!(crate::core::StructuredRpcError::decode(&conflict).is_some());
@@ -223,15 +227,16 @@ async fn external_config_conflict_refresh_keeps_derived_runtime_overrides() {
.find(|controller| controller.rpc_method_name() == "openhuman.config_update_model_settings")
.expect("config model settings RPC is registered");
let conflict = CoreContext::scope(ctx.clone(), async {
- controller.invoke(
- DispatchCtx::new(ctx.clone()),
- json!({"default_temperature": 0.8})
- .as_object()
- .unwrap()
- .clone(),
- )
- .await
- .unwrap_err()
+ controller
+ .invoke(
+ DispatchCtx::new(ctx.clone()),
+ json!({"default_temperature": 0.8})
+ .as_object()
+ .unwrap()
+ .clone(),
+ )
+ .await
+ .unwrap_err()
})
.await;
assert!(crate::core::StructuredRpcError::decode(&conflict).is_some());
@@ -253,15 +258,16 @@ async fn external_config_conflict_refresh_keeps_derived_runtime_overrides() {
assert!(refreshed.composio.host_credential.is_some());
CoreContext::scope(ctx.clone(), async {
- controller.invoke(
- DispatchCtx::new(ctx.clone()),
- json!({"default_temperature": 0.6})
- .as_object()
- .unwrap()
- .clone(),
- )
- .await
- .expect("a save after conflict refresh should use the advanced revision");
+ controller
+ .invoke(
+ DispatchCtx::new(ctx.clone()),
+ json!({"default_temperature": 0.6})
+ .as_object()
+ .unwrap()
+ .clone(),
+ )
+ .await
+ .expect("a save after conflict refresh should use the advanced revision");
})
.await;
@@ -285,15 +291,16 @@ async fn external_config_conflict_refresh_keeps_derived_runtime_overrides() {
later_external.autonomy.enabled = false;
later_external.save().await.unwrap();
let later_conflict = CoreContext::scope(grandchild.clone(), async {
- controller.invoke(
- DispatchCtx::new(grandchild.clone()),
- json!({"default_temperature": 0.7})
- .as_object()
- .unwrap()
- .clone(),
- )
- .await
- .unwrap_err()
+ controller
+ .invoke(
+ DispatchCtx::new(grandchild.clone()),
+ json!({"default_temperature": 0.7})
+ .as_object()
+ .unwrap()
+ .clone(),
+ )
+ .await
+ .unwrap_err()
})
.await;
assert!(crate::core::StructuredRpcError::decode(&later_conflict).is_some());
@@ -355,15 +362,16 @@ async fn nested_context_refresh_does_not_pin_a_previous_external_value() {
external.default_model = Some("external-first".into());
external.save().await.unwrap();
let first_conflict = CoreContext::scope(first_context.clone(), async {
- controller.invoke(
- DispatchCtx::new(first_context.clone()),
- json!({"default_temperature": 0.8})
- .as_object()
- .unwrap()
- .clone(),
- )
- .await
- .unwrap_err()
+ controller
+ .invoke(
+ DispatchCtx::new(first_context.clone()),
+ json!({"default_temperature": 0.8})
+ .as_object()
+ .unwrap()
+ .clone(),
+ )
+ .await
+ .unwrap_err()
})
.await;
assert!(crate::core::StructuredRpcError::decode(&first_conflict).is_some());
@@ -387,15 +395,16 @@ async fn nested_context_refresh_does_not_pin_a_previous_external_value() {
external.default_model = Some("external-second".into());
external.save().await.unwrap();
let second_conflict = CoreContext::scope(nested.clone(), async {
- controller.invoke(
- DispatchCtx::new(nested.clone()),
- json!({"default_temperature": 0.7})
- .as_object()
- .unwrap()
- .clone(),
- )
- .await
- .unwrap_err()
+ controller
+ .invoke(
+ DispatchCtx::new(nested.clone()),
+ json!({"default_temperature": 0.7})
+ .as_object()
+ .unwrap()
+ .clone(),
+ )
+ .await
+ .unwrap_err()
})
.await;
assert!(crate::core::StructuredRpcError::decode(&second_conflict).is_some());
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index 6d5445a784..9ed1234574 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -12,8 +12,8 @@ use std::{
use serde_json::{Map, Value};
-use crate::core::ControllerSchema;
use crate::core::runtime::DispatchCtx;
+use crate::core::ControllerSchema;
/// A pinned, boxed future returned by a controller handler.
pub type ControllerFuture = Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'static>>;
diff --git a/crates/openhuman-core/src/core/all_bound_controller_tests.rs b/crates/openhuman-core/src/core/all_bound_controller_tests.rs
index 048ae56620..2b0f8e22e6 100644
--- a/crates/openhuman-core/src/core/all_bound_controller_tests.rs
+++ b/crates/openhuman-core/src/core/all_bound_controller_tests.rs
@@ -1,8 +1,8 @@
use super::*;
use crate::core::{FieldSchema, TypeSchema};
use std::sync::{
- Mutex,
atomic::{AtomicUsize, Ordering},
+ Mutex,
};
static CALLS: AtomicUsize = AtomicUsize::new(0);
@@ -208,7 +208,11 @@ fn production_registry_binds_threads_upsert_to_its_declared_parser() {
.map(|grouped| &grouped.controller)
.filter(|entry| entry.schema.method_name() == "threads.upsert")
.collect();
- assert_eq!(entries.len(), 1, "threads.upsert has one raw registry entry");
+ assert_eq!(
+ entries.len(),
+ 1,
+ "threads.upsert has one raw registry entry"
+ );
let entry = entries[0];
let bound_methods: Vec<_> = registry()
.iter()
@@ -230,7 +234,10 @@ fn production_registry_binds_threads_upsert_to_its_declared_parser() {
.filter(|field| field.required)
.map(|field| field.name)
.collect();
- assert_eq!(declared, required, "required fields are independent contract");
+ assert_eq!(
+ declared, required,
+ "required fields are independent contract"
+ );
for example in [
json!({"id":"t1", "title":"Hello", "created_at":"2026-04-22T00:00:00Z"}),
diff --git a/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs b/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs
index 981bc9cb19..16c958cdcb 100644
--- a/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs
+++ b/crates/openhuman-core/src/core/all_dispatch_ctx_tests.rs
@@ -1,6 +1,6 @@
//! The dispatch context reaches the handler as an argument, per call.
-use serde_json::{Map, Value, json};
+use serde_json::{json, Map, Value};
use super::*;
use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};
diff --git a/crates/openhuman-core/src/core/all_extensions_tests.rs b/crates/openhuman-core/src/core/all_extensions_tests.rs
index 7626dfc05b..b77961284f 100644
--- a/crates/openhuman-core/src/core/all_extensions_tests.rs
+++ b/crates/openhuman-core/src/core/all_extensions_tests.rs
@@ -31,11 +31,9 @@ async fn registry_extension_is_visible_to_every_lookup_and_dispatches() {
Some("openhuman.ext_probe_ping")
);
assert!(schema_for_rpc_method("openhuman.ext_probe_ping").is_some());
- assert!(
- all_controller_schemas()
- .iter()
- .any(|s| s.namespace == "ext_probe" && s.function == "ping")
- );
+ assert!(all_controller_schemas()
+ .iter()
+ .any(|s| s.namespace == "ext_probe" && s.function == "ping"));
assert_eq!(
namespace_description("ext_probe"),
Some("Registry extension probe.")
diff --git a/crates/openhuman-core/src/core/all_invoke.rs b/crates/openhuman-core/src/core/all_invoke.rs
index 8afacee0fa..6de319ac4a 100644
--- a/crates/openhuman-core/src/core/all_invoke.rs
+++ b/crates/openhuman-core/src/core/all_invoke.rs
@@ -5,7 +5,7 @@ use std::pin::Pin;
use serde_json::{Map, Value};
-use super::{ControllerFuture, internal_registry, registry_view, visible};
+use super::{internal_registry, registry_view, visible, ControllerFuture};
use crate::core::runtime::{CoreContext, DispatchCtx};
type Dispatched = Pin<Box<dyn Future<Output = Option<Result<Value, String>>> + Send + 'static>>;
diff --git a/crates/openhuman-core/src/core/all_schema_contract_tests.rs b/crates/openhuman-core/src/core/all_schema_contract_tests.rs
index 5e877c670a..e70bc535ca 100644
--- a/crates/openhuman-core/src/core/all_schema_contract_tests.rs
+++ b/crates/openhuman-core/src/core/all_schema_contract_tests.rs
@@ -40,11 +40,9 @@ fn registered_memory_contract_rejects_missing_or_optional_question() {
.expect("real recall schema declares question")
.required = false;
}
- assert!(
- independent_registered_schema_contract(&broken)
- .unwrap_err()
- .contains("memory.recall required inputs mismatch")
- );
+ assert!(independent_registered_schema_contract(&broken)
+ .unwrap_err()
+ .contains("memory.recall required inputs mismatch"));
}
}
@@ -142,11 +140,9 @@ fn registered_wallet_schema_contract_rejects_missing_encrypted_mnemonic() {
.inputs
.retain(|input| input.name != "encryptedMnemonic");
- assert!(
- independent_registered_schema_contract(&schema)
- .unwrap_err()
- .contains("is missing required input `encryptedMnemonic`")
- );
+ assert!(independent_registered_schema_contract(&schema)
+ .unwrap_err()
+ .contains("is missing required input `encryptedMnemonic`"));
}
/// Built-in/internal snapshots avoid ambient DomainSet filtering and global
@@ -243,19 +239,15 @@ fn real_contract_inventory_rejects_a_missing_and_an_extra_row() {
let removed = contracts
.pop()
.expect("representative contracts are nonempty");
- assert!(
- verify_parameter_contracts(&controllers, &contracts)
- .unwrap_err()
- .contains("missing contract")
- );
+ assert!(verify_parameter_contracts(&controllers, &contracts)
+ .unwrap_err()
+ .contains("missing contract"));
contracts.push(removed.clone());
contracts.push(ControllerParamContract {
method: "unregistered.fixture",
..removed
});
- assert!(
- verify_parameter_contracts(&controllers, &contracts)
- .unwrap_err()
- .contains("extra contract")
- );
+ assert!(verify_parameter_contracts(&controllers, &contracts)
+ .unwrap_err()
+ .contains("extra contract"));
}
diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rs
index 74822ffd29..c1cd50f25f 100644
--- a/crates/openhuman-core/src/core/all_tests.rs
+++ b/crates/openhuman-core/src/core/all_tests.rs
@@ -856,8 +856,8 @@ fn every_registered_controller_has_matching_declared_schema() {
// --- DomainSet registration filter (#4796) ------------------------------
-use crate::core::runtime::DomainSet;
use crate::core::runtime::context::CoreContext;
+use crate::core::runtime::DomainSet;
/// The [`DomainGroup`] a registered controller (agent-facing OR internal) is
/// tagged with, looked up by its namespace. Test-only helper over the private
diff --git a/crates/openhuman-core/src/core/schema_test_support_tests.rs b/crates/openhuman-core/src/core/schema_test_support_tests.rs
index 7def87c3fa..badc747371 100644
--- a/crates/openhuman-core/src/core/schema_test_support_tests.rs
+++ b/crates/openhuman-core/src/core/schema_test_support_tests.rs
@@ -61,11 +61,9 @@ fn contract_inventory_rejects_missing_extra_duplicate_and_empty_rows() {
.unwrap_err()
.contains("duplicate contract")
);
- assert!(
- verify_parameter_contracts(&[], &[])
- .unwrap_err()
- .contains("empty")
- );
+ assert!(verify_parameter_contracts(&[], &[])
+ .unwrap_err()
+ .contains("empty"));
}
#[test]
@@ -112,55 +110,43 @@ fn callback_identity_and_explicit_example_failures_are_not_hidden() {
);
let mut broken = contract;
broken.examples = vec![serde_json::json!({"id":7})];
- assert!(
- verify_parameter_contracts(&[controller], &[broken])
- .unwrap_err()
- .contains("schema rejects example")
- );
+ assert!(verify_parameter_contracts(&[controller], &[broken])
+ .unwrap_err()
+ .contains("schema rejects example"));
}
#[test]
fn duplicate_controller_and_schema_identity_failures_are_rejected() {
let (controller, contract) = fixture();
- assert!(
- verify_parameter_contracts(
- &[controller.clone(), controller.clone()],
- std::slice::from_ref(&contract)
- )
- .unwrap_err()
- .contains("duplicate controller")
- );
+ assert!(verify_parameter_contracts(
+ &[controller.clone(), controller.clone()],
+ std::slice::from_ref(&contract)
+ )
+ .unwrap_err()
+ .contains("duplicate controller"));
let mut broken = controller.schema.clone();
broken.function = "other";
- assert!(
- verify_parameter_schema(&broken, &contract)
- .unwrap_err()
- .contains("method identity")
- );
+ assert!(verify_parameter_schema(&broken, &contract)
+ .unwrap_err()
+ .contains("method identity"));
let mut broken = controller.schema;
broken.description = " ";
- assert!(
- verify_parameter_schema(&broken, &contract)
- .unwrap_err()
- .contains("no description")
- );
+ assert!(verify_parameter_schema(&broken, &contract)
+ .unwrap_err()
+ .contains("no description"));
}
#[test]
fn examples_must_be_objects_and_satisfy_schema_before_decoding() {
let (controller, mut contract) = fixture();
contract.examples = vec![Value::Null];
- assert!(
- verify_parameter_schema(&controller.schema, &contract)
- .unwrap_err()
- .contains("not an object")
- );
+ assert!(verify_parameter_schema(&controller.schema, &contract)
+ .unwrap_err()
+ .contains("not an object"));
contract.examples = vec![serde_json::json!({})];
- assert!(
- verify_parameter_schema(&controller.schema, &contract)
- .unwrap_err()
- .contains("schema rejects example")
- );
+ assert!(verify_parameter_schema(&controller.schema, &contract)
+ .unwrap_err()
+ .contains("schema rejects example"));
}
#[test]
diff --git a/crates/openhuman-core/src/threads/schemas/registry.rs b/crates/openhuman-core/src/threads/schemas/registry.rs
index 608bded3e0..608cd9b31e 100644
--- a/crates/openhuman-core/src/threads/schemas/registry.rs
+++ b/crates/openhuman-core/src/threads/schemas/registry.rs
@@ -1,8 +1,8 @@
//! Controller schema and registered-controller lists for the `threads`
//! namespace.
-use crate::core::ControllerSchema;
use crate::core::all::{BoundRegisteredController, ControllerEntry, RegisteredController};
+use crate::core::ControllerSchema;
use super::handlers::{
handle_create_new, handle_delete, handle_edit_message, handle_generate_title, handle_goal_get,