The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(test): align artifact store paths with detached storage layout
Steven Enamakel7bcf62659783
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output_tests.rsindex abe596c5fe..4fb0740fcc 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_output_tests.rs@@ -45,9 +45,7 @@ async fn same_tool_calls_persist_artifacts_under_distinct_call_ids() {.await.expect("second artifact is persisted");- let root = temp- .path()- .join("artifacts/tool-results/identity-session/echo");+ let root = temp.path().join("identity-session/echo");assert_eq!(std::fs::read_to_string(root.join("echo-1.txt")).expect("first artifact"),"first result is deliberately oversized"diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_artifact_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_artifact_tests.rsindex 0a83525968..8392d28176 100644--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_artifact_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_output_artifact_tests.rs@@ -6,14 +6,14 @@ use super::*;fn artifact_mw(summarizer: Option<Arc<dyn PayloadSummarizer>>,- action_dir: &std::path::Path,+ storage_dir: &std::path::Path,) -> ToolOutputMiddleware {ToolOutputMiddleware {budget_bytes: 1_000,payload_summarizer: summarizer,artifact_store: Some(crate::agent::harness::tool_result_artifacts::new_tool_result_store(- action_dir.to_path_buf(),+ storage_dir.to_path_buf(),"session",),),@@ -36,6 +36,8 @@ fn summarized(summary: &str) -> Arc<dyn PayloadSummarizer> {async fn a_wrapped_read_of_a_persisted_artifact_is_paged_not_resummarized_or_repersisted() {let tmp = tempfile::tempdir().unwrap();let mw = artifact_mw(Some(summarized("SUMMARY")), tmp.path());+ // A relative pointer from a transcript written before the store was+ // detached still pages.let path = "artifacts/tool-results/session/use_skill/earlier.txt";// The read arrives wrapped, reported under the wrapper's name, exactly as// `use_skill` delivers `file_read`.@@ -67,7 +69,45 @@ async fn a_wrapped_read_of_a_persisted_artifact_is_paged_not_resummarized_or_rep&rendered[page_end..]);assert!(- !tmp.path().join("artifacts").exists(),+ !tmp.path().join("session").exists(),+ "reading an artifact must not persist it again as a new artifact"+ );+}++/// The detached store's own pointer is absolute; a read of it is recognised+/// and paged the same way, not summarized or stored again.+#[tokio::test]+async fn a_read_of_an_absolute_artifact_pointer_is_paged_not_repersisted() {+ let tmp = tempfile::tempdir().unwrap();+ let storage = tmp.path().join("tool-results");+ let mw = artifact_mw(Some(summarized("SUMMARY")), &storage);+ let pointer = storage+ .join("session/shell/earlier.txt")+ .to_string_lossy()+ .into_owned();+ let mut call = TaToolCall::new("c1", "file_read", json!({"path": pointer}));+ let mut ctx = ctx();+ mw.before_tool(&mut ctx, &(), &mut call).await.unwrap();+ let mut result = tool_result("file_read", &"y".repeat(5_000));++ mw.after_tool(&mut ctx, &(), &invocation("c1", "file_read"), &mut result)+ .await+ .unwrap();++ let rendered = result_text(&result);+ assert!(+ rendered.starts_with("yyyy"),+ "{}",+ &rendered[..rendered.len().min(120)]+ );+ assert!(+ rendered.contains(&format!(+ "Continue with file_read {{\"path\":\"{pointer}\",\"offset\":"+ )),+ "the continuation must name the same absolute pointer: {rendered}"+ );+ assert!(+ !storage.join("session/file_read").exists(),"reading an artifact must not persist it again as a new artifact");}@@ -91,11 +131,8 @@ async fn an_oversized_result_is_stored_as_the_tool_returned_it_not_as_rewritten("an over-budget result is persisted: {}",result_text(&result));- let stored = std::fs::read_to_string(- tmp.path()- .join("artifacts/tool-results/session/echo/c1.txt"),- )- .expect("artifact written");+ let stored =+ std::fs::read_to_string(tmp.path().join("session/echo/c1.txt")).expect("artifact written");assert_eq!(stored, raw,"the artifact must hold the tool's own output, not the rewritten copy"@@ -120,11 +157,8 @@ async fn a_raw_result_file_read_cannot_open_is_stored_as_the_processed_copy() {.0.unwrap();- let stored = std::fs::read_to_string(- tmp.path()- .join("artifacts/tool-results/session/echo/c1.txt"),- )- .expect("artifact written");+ let stored =+ std::fs::read_to_string(tmp.path().join("session/echo/c1.txt")).expect("artifact written");assert_eq!(stored, summary,"a raw body over file_read's limit would be unreadable, so the processed copy is stored"