Skip to content

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

fix(toolpacks): unpack file_read so the orchestrator can read result previews

M3gA-Mind4aa53f701c64
diff --git a/crates/openhuman-core/src/tools/toolpacks/registry.rs b/crates/openhuman-core/src/tools/toolpacks/registry.rs
index 263b617e71..7ba5aa0930 100644
--- a/crates/openhuman-core/src/tools/toolpacks/registry.rs
+++ b/crates/openhuman-core/src/tools/toolpacks/registry.rs
@@ -249,7 +249,7 @@ pub const PACKS: &[ToolPack] = &[
},
ToolPack {
id: "files",
- summary: "Files and repositories: read, write, grep, glob, list, git.",
+ summary: "Files and repositories: grep, glob, list, git.",
// `shell` covers every one of these for an agent that has it, so on a
// belt that also carries `shell` the family is duplicate surface
// charged on every turn. It stays one `use_skill` away, and the
@@ -271,7 +271,20 @@ pub const PACKS: &[ToolPack] = &[
// no file at all, and `meal-plan` burned eleven rounds discovering it
// had no writer. One ~300 B schema per turn is the right price for the
// single most common assistant task.
- tools: &["file_read", "grep", "glob", "list", "git_operations"],
+ //
+ // `file_read` left too, because the harness itself tells the model to
+ // call it. Every oversized tool result is replaced by a
+ // `[tool_result_preview]` whose `read_with:` line is
+ // `file_read {"path": …}` (`agent/harness/tool_result_artifacts`), and
+ // the orchestrator is the agent that receives most of those previews
+ // (Gmail listings, catalogue dumps, search results). Packed, the same
+ // rule DENIED it, and the bare-name router (`packed_tool_route`) does
+ // not route a denied tool, so the call answered `unknown tool`. Observed
+ // on v0.64.0: asked to list ten emails, the orchestrator followed the
+ // preview, got `unknown tool file_read`, then invented `ranges` and
+ // `tool_read_file`, misused `desktop_continue_goal` and `plan`, and ran
+ // out of iterations without reading its own result.
+ tools: &["grep", "glob", "list", "git_operations"],
owners: &[
"code_executor",
"critic",
diff --git a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs
index 3961143e22..ad4a68c9ac 100644
--- a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs
+++ b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs
@@ -578,8 +578,9 @@ fn every_pack_declares_the_tools_it_is_named_for() {
&[
// No `file_write`: it is the only create-capable tool on any
// belt, and packing it denied the orchestrator every route to a
- // new file. See the comment in `registry.rs`.
- "file_read",
+ // new file. No `file_read`: it is the tool every
+ // `[tool_result_preview]` names. See the comments in
+ // `registry.rs`.
"grep",
"glob",
"list",
diff --git a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs
index a8e6179d72..76f08a292f 100644
--- a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs
+++ b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests_scoping_and_visibility_tests.rs
@@ -465,6 +465,10 @@ fn a_named_scope_session_closes_the_pack_its_visible_list_never_mentions() {
/// and `use_skill { skill: "files" }` answered "has no tools available in this
/// session". The agent's own `agent.toml` names `file_write` and says it
/// "creates new files"; this pins that the pack table no longer contradicts it.
+///
+/// `file_read` is held to the same rule for a different reason: every
+/// `[tool_result_preview]` the harness emits says `read_with: file_read`, so a
+/// closed `file_read` turns each oversized result into an `unknown tool` loop.
#[test]
fn the_orchestrators_only_file_creator_is_never_closed() {
use crate::agent::orchestration::tools::{ArchetypeDelegationTool, DelegationTarget};
@@ -493,11 +497,17 @@ fn the_orchestrators_only_file_creator_is_never_closed() {
"`file_write` must stay reachable to the orchestrator: {closed:?}"
);
assert!(
- closed.contains(&"file_read"),
- "the rest of the `files` pack is still the specialists' belt: {closed:?}"
+ !closed.contains(&"file_read"),
+ "`file_read` must stay reachable: every result preview names it: {closed:?}"
);
assert!(
- registry::pack_for_tool("file_write").is_none(),
- "`file_write` must belong to no pack — that is what keeps it open"
+ closed.contains(&"grep"),
+ "the rest of the `files` pack is still the specialists' belt: {closed:?}"
);
+ for tool in ["file_write", "file_read"] {
+ assert!(
+ registry::pack_for_tool(tool).is_none(),
+ "`{tool}` must belong to no pack — that is what keeps it open"
+ );
+ }
}