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(sandbox): a TinyBox timeout is reported as the command's timeout
sanil-2392ba1a87b8e6
diff --git a/crates/openhuman-core/src/sandbox/shell_exec.rs b/crates/openhuman-core/src/sandbox/shell_exec.rsindex 4bb4fa964e..5803d0ce1b 100644--- a/crates/openhuman-core/src/sandbox/shell_exec.rs+++ b/crates/openhuman-core/src/sandbox/shell_exec.rs@@ -230,7 +230,7 @@ async fn collect_process(mut abandoned: tokio::sync::oneshot::Receiver<std::convert::Infallible>,meter: Option<super::shell_progress::ShellOutputMeter>,) -> anyhow::Result<SandboxExecResult> {- use contract::{ExecutionFailure, ExecutionState, OutputStream};+ use contract::{ExecutionState, OutputStream};use tokio::sync::oneshot::error::TryRecvError;let deadline = tokio::time::Instant::now() + timeout;@@ -285,11 +285,10 @@ async fn collect_process(}ExecutionState::Cancelled if has_chunks => continue,ExecutionState::Cancelled => break requested_cancel,- ExecutionState::Failed {- code: ExecutionFailure::CleanupFailed,- } => anyhow::bail!("TinyBox retained native process cleanup for retry"),- ExecutionState::Failed { .. } => {- anyhow::bail!("TinyBox native shell execution failed")+ ExecutionState::Failed { .. } if has_chunks => continue,+ ExecutionState::Failed { code } => {+ tracing::debug!(?code, "[sandbox:shell] TinyBox reported a failed execution");+ break failure_timed_out(code)?;}}};@@ -308,6 +307,29 @@ async fn collect_process(})}+/// What a terminal TinyBox failure means for the command. The module enforces+/// the same runtime budget the host waits for, so a command that runs to its+/// limit usually ends as `TimedOut` before the host's own cancel lands: that is+/// the command's timeout, reported like one (`Ok(true)`). Anything else is a+/// real sandbox failure, named by its code.+#[cfg(feature = "modules")]+fn failure_timed_out(code: contract::ExecutionFailure) -> anyhow::Result<bool> {+ use contract::ExecutionFailure;+ match code {+ ExecutionFailure::TimedOut => Ok(true),+ ExecutionFailure::CleanupFailed => {+ anyhow::bail!("TinyBox retained native process cleanup for retry")+ }+ ExecutionFailure::OutputLimit => anyhow::bail!(+ "TinyBox stopped the command: its output exceeded the execution output limit"+ ),+ ExecutionFailure::StartFailed => {+ anyhow::bail!("TinyBox native shell execution failed: the command could not start")+ }+ other => anyhow::bail!("TinyBox native shell execution failed ({other:?})"),+ }+}+#[cfg(feature = "modules")]pub(crate) fn path_string(path: &std::path::Path, label: &str) -> anyhow::Result<String> {path.to_str()diff --git a/crates/openhuman-core/src/sandbox/shell_exec_tests.rs b/crates/openhuman-core/src/sandbox/shell_exec_tests.rsindex 493de9081c..d6e7aae415 100644--- a/crates/openhuman-core/src/sandbox/shell_exec_tests.rs+++ b/crates/openhuman-core/src/sandbox/shell_exec_tests.rs@@ -152,3 +152,15 @@ async fn run_host_feeds_the_callers_meter() {assert!(output.success());assert_eq!(meter.snapshot(), (18, Some("line two".to_string())));}++#[cfg(feature = "modules")]+#[test]+fn a_tinybox_timeout_is_the_commands_timeout_and_other_failures_name_their_code() {+ use contract::ExecutionFailure;+ assert!(failure_timed_out(ExecutionFailure::TimedOut).unwrap());+ let message = |code| failure_timed_out(code).unwrap_err().to_string();+ assert!(message(ExecutionFailure::OutputLimit).contains("output limit"));+ assert!(message(ExecutionFailure::StartFailed).contains("could not start"));+ assert!(message(ExecutionFailure::BackendFailed).contains("BackendFailed"));+ assert!(message(ExecutionFailure::CleanupFailed).contains("retained"));+}