Skip to content

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

fix(runtime): reject non-saas cores in saas-locked processes

Steven Enamakelb09e4f72d166
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rs
index 3c5a3696e2..ce584b7ea0 100644
--- a/crates/openhuman-core/src/core/runtime/context.rs
+++ b/crates/openhuman-core/src/core/runtime/context.rs
@@ -222,6 +222,10 @@ impl CoreContext {
.map(|t| t.name())
.unwrap_or("<process-global>")
);
+ // A process locked to SaaS boots nothing but its own SaaS core.
+ if crate::core::runtime::mode::is_saas() && host_kind != HostKind::Saas {
+ anyhow::bail!("[core-context] this process serves SaaS; refusing a {host_kind:?} core");
+ }
// 1. Ensure all controllers are registered before anything dispatches.
let _ = crate::core::all::all_registered_controllers();
diff --git a/crates/openhuman-core/src/core/server_launcher.rs b/crates/openhuman-core/src/core/server_launcher.rs
index 3881d06785..47c44be64b 100644
--- a/crates/openhuman-core/src/core/server_launcher.rs
+++ b/crates/openhuman-core/src/core/server_launcher.rs
@@ -22,6 +22,10 @@ pub struct ServeRequest {
pub socketio_enabled: bool,
/// Request/response API only, with no background services.
pub headless_api: bool,
+ /// The operating mode (`--mode`).
+ pub mode: crate::core::runtime::Mode,
+ /// The operator's SaaS config file (`--saas-config`); required in SaaS mode.
+ pub saas_config: Option<std::path::PathBuf>,
}
/// Starts a server for a [`ServeRequest`] and resolves when it stops.