Skip to content

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

fix(tinyagents): classify invalid arguments and command failures as permanent

Steven Enamakel2575f8c6ab35
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/tool_outcome_classifier.rs b/crates/openhuman-core/src/agent/tinyagents/host/tool_outcome_classifier.rs
index 1129fa01b5..65affb6468 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/tool_outcome_classifier.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/tool_outcome_classifier.rs
@@ -180,6 +180,8 @@ impl OpenHumanToolOutcomeClassifier {
| ToolFailureClass::ApprovalExpired
| ToolFailureClass::NotFound
| ToolFailureClass::Unsupported
+ | ToolFailureClass::InvalidArguments
+ | ToolFailureClass::CommandFailed
| ToolFailureClass::Unknown => OutcomeClass::PermanentFailure,
}
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
index e3b8d342d2..011e169a2b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/failure_policy.rs
@@ -185,6 +185,13 @@ pub(super) fn classified_recovery_policy(
// there can repeat an effect the agent cannot observe.
Class::Timeout if tool == "shell" => ("uncertain_side_effect", 1),
Class::Timeout => ("uncertain_side_effect", 0),
+ // The harness's own schema-validation answer, classified from its
+ // prefix before any keyword in the echoed schema could read as a
+ // timeout or a credential failure.
+ Class::InvalidArguments => ("invalid_arguments", ARGUMENT_SCHEMA_RECOVERY),
+ // A finished command's exit report; `is_command_exit_report` above
+ // already returns before this for the bare shape. Same reasoning.
+ Class::CommandFailed => return None,
Class::Unknown if is_recoverable_tool_failure(error) => ("transient", 2),
// Its own class, not the `validation` bucket: the ledger keys on
// (class, operation, scope), so pooling this with `unknown tool` and
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
index 4178576e4f..5102c06877 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
@@ -334,7 +334,7 @@ impl Tool for ModuleReplTool {
self.schema.clone()
}
- async fn execute(&self, mut args: Value) -> anyhow::Result<ToolResult> {
+ async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {
let Some(raw) = args.get("handle").and_then(Value::as_str) else {
return Ok(ToolResult::error("missing required argument: handle"));
};
@@ -362,9 +362,6 @@ impl Tool for ModuleReplTool {
self.name,
content.len()
);
- if let Some(object) = args.as_object_mut() {
- object.insert("handle".into(), Value::String(handle.clone()));
- }
self.run_stock(handle, content, args).await
}