Skip to content

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

fix(agent): report the runtime's actual shell flavor to the model

Steven Enamakel3e4a8a196bce
diff --git a/crates/openhuman-core/src/agent/host_runtime.rs b/crates/openhuman-core/src/agent/host_runtime.rs
index 91667b94ef..bf77ba06a8 100644
--- a/crates/openhuman-core/src/agent/host_runtime.rs
+++ b/crates/openhuman-core/src/agent/host_runtime.rs
@@ -17,6 +17,12 @@ pub trait RuntimeAdapter: Send + Sync {
fn memory_budget(&self) -> u64 {
0
}
+ /// The shell family [`Self::build_shell_command`] runs commands under, so
+ /// what the `shell` tool tells the model matches what actually executes.
+ /// Defaults to the host's own shell.
+ fn shell_flavor(&self) -> platform_shell::ShellFlavor {
+ platform_shell::ShellFlavor::current()
+ }
fn build_shell_command(
&self,
command: &str,
@@ -158,6 +164,12 @@ impl RuntimeAdapter for DockerRuntime {
self.config.memory_limit_mb.unwrap_or(0)
}
+ /// Commands run under `sh -lc` inside the container on every host,
+ /// including Windows, so the model must be told POSIX, not cmd.exe.
+ fn shell_flavor(&self) -> platform_shell::ShellFlavor {
+ platform_shell::ShellFlavor::Posix
+ }
+
fn build_shell_command(
&self,
command: &str,
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index 556a17872b..a260a8b59b 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -169,7 +169,7 @@ impl Tool for ShellTool {
}
fn description(&self) -> &str {
- shell_description(ShellFlavor::current())
+ shell_description(self.runtime.shell_flavor())
}
fn parameters_schema(&self) -> serde_json::Value {
@@ -178,7 +178,7 @@ impl Tool for ShellTool {
"properties": {
"command": {
"type": "string",
- "description": command_param_description(ShellFlavor::current())
+ "description": command_param_description(self.runtime.shell_flavor())
},
"category": {
"type": "string",