Skip to content

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

chore: files changed crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests

Steven Enamakel07067eb65041
diff --git a/crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs b/crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs
index d6b9c976a7..126c532e9f 100644
--- a/crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs
+++ b/crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs
@@ -46,47 +46,21 @@ fn policy_with(action_dir: PathBuf, workspace_dir: PathBuf) -> Arc<SecurityPolic
})
}
-// ── The prompt contract (stays host-side: OpenHuman prompt text) ──────────────
+// ── The prompt contract (renders upstream; the host passes its tool name) ─────
#[test]
-fn prompt_contract_names_both_directories_and_the_write_step() {
- let rendered = render_artifact_offload_contract();
- assert!(rendered.starts_with(ARTIFACT_OFFLOAD_HEADING));
- assert!(rendered.contains(OUTPUTS_DIR));
- assert!(rendered.contains(SCRATCH_DIR));
+fn prompt_contract_names_the_host_write_tool_and_not_the_read_tool() {
+ let rendered =
+ tinyagents_harness::artifacts::render_artifact_offload_contract(OFFLOAD_WRITE_TOOL);
assert!(rendered.contains(OFFLOAD_WRITE_TOOL));
-}
-
-#[test]
-fn prompt_contract_names_no_tool_the_agent_may_not_hold() {
- // A prompt may only name tools its agent actually holds: advertising one it
- // lacks produces hallucinated calls that fail. The reader's tool in
- // particular belongs to a different agent.
- let rendered = render_artifact_offload_contract();
+ // A prompt may only name tools its agent actually holds: the reader's tool
+ // belongs to a different agent.
assert!(
!rendered.contains(READ_TOOL),
"the contract must not name the parent's reading tool: {rendered}"
);
}
-#[test]
-fn offload_contract_is_rendered_only_for_agents_holding_a_write_tool() {
- let mut tools = HashSet::new();
- assert!(
- !should_render_offload_contract(&tools),
- "an agent with no tools cannot offload"
- );
-
- tools.insert("web_search".to_string());
- assert!(
- !should_render_offload_contract(&tools),
- "a search-only agent has no filesystem tool"
- );
-
- tools.insert(OFFLOAD_WRITE_TOOL.to_string());
- assert!(should_render_offload_contract(&tools));
-}
-
#[test]
fn read_and_write_tools_are_distinct() {
// They name different agents' capabilities. Collapsing them would either
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/prompt.rs b/crates/openhuman-core/src/agent/subagent_host/ops/prompt.rs
index ddaef49512..e2305d40b4 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/prompt.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/prompt.rs
@@ -3,10 +3,11 @@
//! Includes the role-contract suffix, its injector, and the tool-spec
//! deduplication helper used before sending specs to the provider.
-use crate::agent::harness::artifact_offload::{
+use crate::agent::harness::artifact_offload::OFFLOAD_WRITE_TOOL;
+use std::collections::HashSet;
+use tinyagents_harness::artifacts::{
render_artifact_offload_contract, should_render_offload_contract, ARTIFACT_OFFLOAD_HEADING,
};
-use std::collections::HashSet;
use tinytools::ToolSpec;
// ─────────────────────────────────────────────────────────────────────────────
@@ -86,7 +87,7 @@ pub(crate) fn append_artifact_offload_contract(
agent_id: &str,
visible_tool_names: &HashSet<String>,
) -> String {
- if !should_render_offload_contract(visible_tool_names) {
+ if !should_render_offload_contract(visible_tool_names, OFFLOAD_WRITE_TOOL) {
tracing::debug!(
agent_id = %agent_id,
"[artifact] sub-agent holds no file-write tool — skipping offload contract (harness-side offload still applies)"
@@ -102,7 +103,7 @@ pub(crate) fn append_artifact_offload_contract(
prompt.push('\n');
}
prompt.push('\n');
- prompt.push_str(&render_artifact_offload_contract());
+ prompt.push_str(&render_artifact_offload_contract(OFFLOAD_WRITE_TOOL));
tracing::debug!(
agent_id = %agent_id,