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
test: decouple process cancellation tests from platform shell helper
Steven Enamakel9459bb67dcb0
diff --git a/crates/openhuman-core/src/cron/scheduler_tests.rs b/crates/openhuman-core/src/cron/scheduler_tests.rsindex b9ccc139b8..39db76ffe4 100644--- a/crates/openhuman-core/src/cron/scheduler_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_tests.rs@@ -257,12 +257,12 @@ async fn security_policy_block_halts_without_spending_the_retry_budget() {/// The spawn used to name `sh` itself, and `CreateProcessW` cannot resolve that/// on Windows — so every scheduled shell job failed there with `spawn error:/// program not found` while the identical job ran on macOS and Linux. Routing it-/// through `agent::platform_shell`, which every other shell spawn in the crate-/// already used, is what makes this pass.+/// through the module's native shell member, which selects the shell per+/// platform, is what makes this pass.////// `echo` and the assertion on its output are deliberately shell-agnostic: the/// test names neither `sh` nor `cmd`, so it keeps holding if the platform matrix-/// in `platform_shell` changes.+/// in the module changes.#[tokio::test]async fn a_shell_job_runs_on_this_platform() {let tmp = TempDir::new().unwrap();diff --git a/crates/openhuman-embed/tests/process_cancellation.rs b/crates/openhuman-embed/tests/process_cancellation.rsindex 36f4078bdd..eb6a843a24 100644--- a/crates/openhuman-embed/tests/process_cancellation.rs+++ b/crates/openhuman-embed/tests/process_cancellation.rs@@ -5,6 +5,15 @@use openhuman_core::tools::timeout::{output_or_kill, output_unbounded, ProcessCleanup};use std::time::Duration;+/// A shell child that leads its own process group and dies with its handle, as+/// the module-owned shell children do.+fn shell_child(command: &str) -> tokio::process::Command {+ let mut cmd = tokio::process::Command::new("sh");+ cmd.arg("-c").arg(command).kill_on_drop(true);+ openhuman_core::tools::timeout::own_process_group(cmd.as_std_mut());+ cmd+}+/// Cancelling a tool must also stop descendants of its shell.#[cfg(target_os = "linux")]#[tokio::test]@@ -17,7 +26,7 @@ async fn dropping_command_output_kills_the_shells_children() {async fn dropped_command(bounded: bool) {let scratch = tempfile::tempdir().unwrap();let pidfile = scratch.path().join("child.pid");- let mut cmd = openhuman_core::agent::platform_shell::build_tokio_command(&format!(+ let mut cmd = shell_child(&format!("sleep 30 & echo $$ $! > {}; wait",pidfile.display()));@@ -87,7 +96,7 @@ async fn dropped_command(bounded: bool) {#[tokio::test]async fn captured_commands_preserve_output_and_exit_status() {for bounded in [true, false] {- let mut cmd = openhuman_core::agent::platform_shell::build_tokio_command(+ let mut cmd = shell_child("printf stdout; printf stderr >&2; exit 7",);let output = if bounded {@@ -112,7 +121,7 @@ async fn captured_commands_preserve_output_and_exit_status() {#[tokio::test]async fn deadline_kills_and_reaps_a_command() {let cleanup = ProcessCleanup::default();- let mut command = openhuman_core::agent::platform_shell::build_tokio_command("sleep 30");+ let mut command = shell_child("sleep 30");assert!(cleanup.scope(output_or_kill(&mut command, Duration::from_millis(30))).await@@ -126,7 +135,7 @@ async fn deadline_kills_and_reaps_a_command() {async fn exited_group_leader_is_not_reaped_until_its_descendants_close_the_pipes() {let scratch = tempfile::tempdir().unwrap();let pidfile = scratch.path().join("exited.pid");- let mut cmd = openhuman_core::agent::platform_shell::build_tokio_command(&format!(+ let mut cmd = shell_child(&format!("sleep 30 & echo $$ $! > {}; exit 0",pidfile.display()));