Skip to content

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

refactor(sandbox): simplify worker spawn and fallback expressions

Steven Enamakel3be1a5c5ec04
diff --git a/crates/openhuman-core/src/sandbox/native_jail.rs b/crates/openhuman-core/src/sandbox/native_jail.rs
index cabf762c21..46c76f6455 100644
--- a/crates/openhuman-core/src/sandbox/native_jail.rs
+++ b/crates/openhuman-core/src/sandbox/native_jail.rs
@@ -61,7 +61,7 @@ pub(crate) async fn execute(
let working_dir = working_dir.to_path_buf();
let extra_env = extra_env.clone();
// The worker owns cancellation and resource cleanup if the caller drops its wait.
- return tokio::spawn(async move {
+ tokio::spawn(async move {
execute_owned(
&config,
&policy,
@@ -74,7 +74,7 @@ pub(crate) async fn execute(
.await
})
.await
- .map_err(|_| anyhow::anyhow!("TinyBox native jail worker did not finish"))?;
+ .map_err(|_| anyhow::anyhow!("TinyBox native jail worker did not finish"))?
}
#[cfg(not(feature = "modules"))]
{
@@ -105,11 +105,11 @@ pub(crate) async fn execute_passthrough(
let config = config.clone();
let command = command.to_owned();
let working_dir = working_dir.to_path_buf();
- return tokio::spawn(async move {
+ tokio::spawn(async move {
execute_passthrough_owned(&config, &command, &working_dir, timeout).await
})
.await
- .map_err(|_| anyhow::anyhow!("TinyBox passthrough worker did not finish"))?;
+ .map_err(|_| anyhow::anyhow!("TinyBox passthrough worker did not finish"))?
}
#[cfg(not(feature = "modules"))]
{
diff --git a/crates/openhuman-core/src/sandbox/ops.rs b/crates/openhuman-core/src/sandbox/ops.rs
index ac33bd0c8f..a556ce1bd4 100644
--- a/crates/openhuman-core/src/sandbox/ops.rs
+++ b/crates/openhuman-core/src/sandbox/ops.rs
@@ -227,7 +227,7 @@ pub async fn create_sandbox_backend(policy: &SandboxPolicy) -> SandboxBackendHan
if policy.backend != SandboxBackendKind::Docker {
return create_sandbox_backend_with_config(policy, &crate::config::Config::default())
.await
- .unwrap_or_else(|_| SandboxBackendHandle {
+ .unwrap_or(SandboxBackendHandle {
kind: policy.backend,
status: SandboxStatus::Error,
backend_id: None,