Skip to content

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

test(caps_host): cover tombstone overflow and manifest identity

Steven Enamakel9a3a799ac439
diff --git a/crates/openhuman-core/src/flows/caps_host/service_tests.rs b/crates/openhuman-core/src/flows/caps_host/service_tests.rs
index 66a662e36d..37fb0a6017 100644
--- a/crates/openhuman-core/src/flows/caps_host/service_tests.rs
+++ b/crates/openhuman-core/src/flows/caps_host/service_tests.rs
@@ -87,13 +87,27 @@ fn malformed_agent_request_ids_are_rejected() {
assert!(valid_agent_request_id("client-request-1"));
}
+#[test]
+fn tombstone_capacity_overflow_fails_closed_instead_of_evicting_cancelled_ids() {
+ let mut registry = AgentRunRegistry::default();
+ for index in 0..4_097 {
+ registry.cancel(format!("cancelled-{index}"));
+ }
+
+ let result = registry.admit(
+ "cancelled-4096".into(),
+ state(),
+ tokio_util::sync::CancellationToken::new(),
+ );
+
+ assert!(result.is_err());
+}
+
#[tokio::test]
async fn agent_run_rejects_an_identity_from_another_bound_run() {
let temp = tempfile::TempDir::new().unwrap();
- let binding = super::super::binding_tests::binding(
- crate::core::runtime::DispatchCtx::unbound(),
- &temp,
- );
+ let binding =
+ super::super::binding_tests::binding(crate::core::runtime::DispatchCtx::unbound(), &temp);
let service = CapsHostService::new(Arc::new(binding));
let member = tinybus::MemberName::new(runs::caps::AGENT_RUN).unwrap();
let error = tinybus::service::Interface::call(
diff --git a/crates/openhuman-core/src/modules/tinyflows_tests.rs b/crates/openhuman-core/src/modules/tinyflows_tests.rs
index c83d10399a..62870ddaa3 100644
--- a/crates/openhuman-core/src/modules/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/modules/tinyflows_tests.rs
@@ -307,6 +307,8 @@ async fn serving_caps_host_advertises_v2_without_replacing_other_peer_manifest_e
other_interface,
tinybus::Version::new(4, 2, 0),
));
+ let prior_name = original.name.clone();
+ let prior_version = original.version.clone();
let prior_consumes = original.consumes.clone();
connection
.announce(&original)
@@ -330,6 +332,8 @@ async fn serving_caps_host_advertises_v2_without_replacing_other_peer_manifest_e
.provided(&caps_interface)
.expect("CapsHost is advertised");
assert_eq!(caps_host.speaks, tinybus::Version::new(2, 0, 0));
+ assert_eq!(announced.name, prior_name);
+ assert_eq!(announced.version, prior_version);
assert!(
announced
.provides