Skip to content

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

review: check the triage kill-switch before reading config; leave digest rejection to tinybus

M3gA-Mind0c5372d483f6
diff --git a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
index 3c76e6376c..ca852ca717 100644
--- a/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
+++ b/crates/openhuman-core/src/integrations/composio/bus/trigger_subscriber.rs
@@ -119,10 +119,16 @@ impl EventHandler<DomainEvent> for ComposioTriggerSubscriber {
}
// The env var is a global kill-switch that works even when the config
- // file is corrupt; an unreadable config otherwise fails open to triage.
- let config = ctx.load_config().await;
- if let Some(reason) = triage_skip_reason(config.as_ref().ok(), &toolkit, triage_disabled())
- {
+ // file is corrupt, so it is checked before (and instead of) a config
+ // read; an unreadable config otherwise fails open to triage.
+ let env_disabled = triage_disabled();
+ let config = if env_disabled {
+ None
+ } else {
+ Some(ctx.load_config().await)
+ };
+ let readable = config.as_ref().and_then(|config| config.as_ref().ok());
+ if let Some(reason) = triage_skip_reason(readable, &toolkit, env_disabled) {
tracing::debug!(
toolkit = %toolkit,
trigger = %trigger,
@@ -130,7 +136,7 @@ impl EventHandler<DomainEvent> for ComposioTriggerSubscriber {
);
return;
}
- if let Err(e) = &config {
+ if let Some(Err(e)) = &config {
tracing::warn!(
toolkit = %toolkit,
trigger = %trigger,
diff --git a/crates/openhuman-core/src/modules/ops_tests.rs b/crates/openhuman-core/src/modules/ops_tests.rs
index b7b343203d..31847cf39b 100644
--- a/crates/openhuman-core/src/modules/ops_tests.rs
+++ b/crates/openhuman-core/src/modules/ops_tests.rs
@@ -46,43 +46,39 @@ fn test_bundled_record() -> &'static crate::modules::types::ModuleRecord {
}))
}
-/// The record pins the empty-input digest, so `b""` is a bundle whose digest
-/// matches but whose archive cannot be read, and `b"tampered"` is one whose
-/// digest does not match. Both must be reported, never replaced by the cache.
+/// The record pins the empty-input digest, so the staged empty archive passes
+/// the digest check and fails to unpack. Digest rejection itself is tinybus's
+/// to test; this pins only that the host reports it and never falls back to
+/// the user cache.
#[tokio::test]
-async fn a_bad_installer_bundle_is_reported_without_falling_back_to_the_cache() {
- for staged in [&b""[..], &b"tampered"[..]] {
- let record = test_bundled_record();
- let bundled = tempfile::tempdir().unwrap();
- let user_cache = tempfile::tempdir().unwrap();
- let bundle_dir = tinybus::module::artifact_dir(
- bundled.path(),
- record.id,
- record.version,
- record.assets[0].host_key,
- )
- .unwrap();
- std::fs::create_dir_all(&bundle_dir).unwrap();
- std::fs::write(bundle_dir.join(record.assets[0].archive), staged).unwrap();
-
- let runtime = crate::modules::runtime::runtime().await.unwrap();
- let error = Resolver::load_cached(
- runtime,
- &record.release(),
- user_cache.path(),
- &serde_json::json!({}),
- false,
- Some(bundled.path()),
- )
- .unwrap_err();
-
- assert!(error.contains("installer bundle"), "{staged:?}: {error}");
- assert!(
- error.contains("repairing the installation"),
- "{staged:?}: {error}"
- );
- assert!(!user_cache.path().join(record.id).exists());
- }
+async fn an_unreadable_installer_bundle_is_reported_without_falling_back_to_the_cache() {
+ let record = test_bundled_record();
+ let bundled = tempfile::tempdir().unwrap();
+ let user_cache = tempfile::tempdir().unwrap();
+ let bundle_dir = tinybus::module::artifact_dir(
+ bundled.path(),
+ record.id,
+ record.version,
+ record.assets[0].host_key,
+ )
+ .unwrap();
+ std::fs::create_dir_all(&bundle_dir).unwrap();
+ std::fs::write(bundle_dir.join(record.assets[0].archive), b"").unwrap();
+
+ let runtime = crate::modules::runtime::runtime().await.unwrap();
+ let error = Resolver::load_cached(
+ runtime,
+ &record.release(),
+ user_cache.path(),
+ &serde_json::json!({}),
+ false,
+ Some(bundled.path()),
+ )
+ .unwrap_err();
+
+ assert!(error.contains("installer bundle"), "{error}");
+ assert!(error.contains("repairing the installation"), "{error}");
+ assert!(!user_cache.path().join(record.id).exists());
}
#[tokio::test]