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(session-host): store the definition's own id, and stop a vacuous test
sanil-23987d77139345
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rsindex fe251ce892..e3c4b1b381 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs@@ -67,8 +67,13 @@ impl SessionHostBuilder {definition.id));}- (Some(name), _) => name,- (None, Some(definition)) => definition.id.clone(),+ // The definition's own id, not the caller's spelling of it. They+ // agree after trimming by the arm above, but only some readers+ // trim: `OpenHumanDefinitionRegistry` does,+ // `AgentDefinitionRegistry::get` does not, so a padded name would+ // resolve through one and miss through the other.+ (Some(_), Some(definition)) | (None, Some(definition)) => definition.id.clone(),+ (Some(name), None) => name,(None, None) => "main".to_string(),};// On-demand tool disclosure: withhold packed tools' schemas from thediff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_session_definition_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_session_definition_tests.rsindex a1fbe3eb13..c5b4d465be 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_session_definition_tests.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_session_definition_tests.rs@@ -131,10 +131,14 @@ async fn without_a_definition_the_same_id_is_still_unknown() {// The counterpart, and the reason this route had to exist: nothing else// the builder takes can put an id in the catalogue.let agent = seat(None);- let Some(base) = agent.hosted_base.as_ref() else {- // No catalogue at all, which is the "unknown" this test asserts.- return;- };+ // Not an early return on absence: a builder that stopped creating a+ // hosted authority at all would satisfy that, which is the regression+ // this test is here to catch. Under `cfg(test)` the builder always has a+ // catalogue to fall back on, so requiring one is safe.+ let base = agent+ .hosted_base+ .as_ref()+ .expect("a session always has a hosted authority under cfg(test)");assert!(base.session_definition.is_none());let catalogue = OpenHumanDefinitionRegistry::new(Arc::clone(&base.definitions))@@ -189,3 +193,24 @@ fn a_name_the_definition_contradicts_fails_the_build() {assert!(message.contains("some-other-id"), "{message}");assert!(message.contains(SEAT), "{message}");}++#[tokio::test]+async fn a_padded_name_is_stored_as_the_definitions_own_id() {+ // ` foo ` and `foo` agree after trimming, so the consistency check admits+ // the pair. Storing the caller's spelling would then resolve through+ // `OpenHumanDefinitionRegistry` (which trims) and miss through+ // `AgentDefinitionRegistry::get` (which does not), so the id is+ // normalized to the definition's own.+ let agent = bare()+ .agent_definition_name(format!(" {SEAT} "))+ .agent_definition(definition(SEAT, vec!["desk_say"]))+ .build()+ .expect("a name that differs only by padding is not a contradiction");++ assert_eq!(agent.agent_definition_name(), SEAT);+ assert!(catalogue(&agent)+ .resolve(agent.agent_definition_name())+ .await+ .expect("resolution never errors")+ .is_some());+}