Skip to content

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

fix(rpc): detect help flags anywhere in mcp and agent tails

Steven Enamakel9f7a0bb92855
diff --git a/crates/openhuman-rpc/src/host.rs b/crates/openhuman-rpc/src/host.rs
index 44270a39bf..c449aae075 100644
--- a/crates/openhuman-rpc/src/host.rs
+++ b/crates/openhuman-rpc/src/host.rs
@@ -144,14 +144,12 @@ fn cli_command_uses_storage(args: &[String], has_cli_handler: impl Fn(&str) -> b
"run" | "serve" | "tui" | "chat" | "sentry-test" => false,
// The MCP server speaks stdio when given no function and runs agent
// sessions, so it needs the backend.
- "mcp" | "mcp-server" => !tail.first().is_some_and(|f| is_help(f)),
+ "mcp" | "mcp-server" => !tail.iter().any(|a| matches!(*a, "-h" | "--help")),
// `call` and `agent` print help when given none, or on a help token
// or flag anywhere in their own tails.
"call" | "agent" => match tail.first() {
None => false,
- Some(function) => {
- !is_help(function) && !tail.iter().any(|a| matches!(*a, "-h" | "--help"))
- }
+ Some(_) => !tail.iter().any(|a| is_help(a)),
},
// A namespace reads help only in the function slot and the slot
// after it; later `--help` tokens are option values to its parser.
diff --git a/crates/openhuman-rpc/src/host_tests.rs b/crates/openhuman-rpc/src/host_tests.rs
index aa7ddc5e96..8b67616a8f 100644
--- a/crates/openhuman-rpc/src/host_tests.rs
+++ b/crates/openhuman-rpc/src/host_tests.rs
@@ -127,6 +127,9 @@ fn cli_storage_is_opened_for_one_shot_commands_only() {
assert!(uses(&["cron", "list", "--format", "json", "--help"]));
assert!(uses(&["cron", "add", "--name", "--help"]));
assert!(uses(&["mcp"]));
+ assert!(!uses(&["mcp", "--verbose", "--help"]));
+ assert!(!uses(&["agent", "foo", "help"]));
+ assert!(!uses(&["call", "foo", "help"]));
assert!(uses(&["mcp-server"]));
assert!(!uses(&["mcp", "--help"]));
assert!(!uses(&["--model", "--help", "cron", "list"]));