Skip to content

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

fix(turn_policy): correct event projection for classified failures

Steven Enamakele09d98471c83
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_classified_failure_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_classified_failure_tests.rs
index 4266665a40..acaaa213db 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_classified_failure_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_classified_failure_tests.rs
@@ -232,6 +232,8 @@ fn an_unknown_tool_is_a_correctable_call_not_a_blocker() {
for error in [
"unknown tool `forbidden_tool` (arguments: {}); valid tools: [file_read]",
"unknown tool `ranges` (arguments: {}); valid tools: [GITHUB_LIST_UNAUTHORIZED_USERS, file_write]",
+ // Current tinyagents corrective: close matches + a `tool_search` pointer.
+ "unknown tool `forbidden_tool`: no tool with that name is available to you, and calling it again will fail the same way. Closest available: `forbidden_list_unauthorized`. To find the right tool, call `tool_search` with what you want to do in plain words, then call a tool it returns.",
] {
assert_eq!(
super::super::repeated_failure::recovery_policy("forbidden_tool", error, false),
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
index 4a90317887..2d6668e248 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_projection.rs
@@ -308,7 +308,7 @@ impl EventListener for OpenhumanEventBridge {
// tool call. Classified `NotFound` (permanent) from the typed
// event itself (#6277): the identical call can never succeed, so
// "try again / run diagnostics" copy would be wrong. The model
- // still got the "valid tools: [...]" corrective.
+ // still got the corrective (close matches + `tool_search`).
let iteration = self.iteration();
let failure = Some(crate::tools::status::describe(
crate::tools::status::ToolFailureClass::NotFound,
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
index 25bb5e3d0f..762a9ae22f 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_policy.rs
@@ -215,8 +215,9 @@ pub(crate) fn run_policy_for(max_iterations: usize, response_cache_enabled: bool
// deleted sentinel was exactly that) and, when it hits, *silently* executes
// that tool and emits `AgentEvent::UnknownToolCall { recovery: "rewrite:.." }`
// WITHOUT injecting a tool message. `ReturnToolError` instead injects a
- // recoverable `unknown tool `<name>` (arguments: ..); valid tools: [..]`
- // result naming the originally-requested tool. Two live consumers depend on
+ // recoverable `unknown tool `<name>`: ...` result naming the originally
+ // requested tool, a few close matches and (when discovery is on) a pointer
+ // to `tool_search` rather than a dump of every callable name. Two live consumers depend on
// that message: (1) the #4419 attempted-tool-name UX and (2) the failure
// classifier in `agent::hooks::sanitize_tool_output`, which labels the result
// `unknown_tool` by matching the "unknown tool" substring. Flipping to Rewrite
diff --git a/vendor/tinyagents b/vendor/tinyagents
index b44f569ba8..f66f8c5cc8 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit b44f569ba8f6531b289d7d3d68b36197746a465d
+Subproject commit f66f8c5cc83f3add0bad412b17c80d78102deda8