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
test(artifact_offload): cover explicit policy blocking unguarded offload
Steven Enamakel88e798b74e60
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.rsindex 9d3e3fa61a..f1300674d5 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@@ -145,6 +145,35 @@ async fn an_action_dir_inside_workspace_dir_is_never_materialized() {);}+#[tokio::test]+async fn explicit_workspace_policy_blocks_unguarded_offload_before_writing() {+ let dir = tempfile::tempdir().expect("tempdir");+ let workspace_dir = dir.path().to_path_buf();+ let action_dir = workspace_dir.join("action");+ std::fs::create_dir_all(&action_dir).expect("action dir");+ let policy = policy_with(action_dir.clone(), workspace_dir);+ // A caller may pass a writer whose own ArtifactPathPolicy is absent or+ // different from the explicit policy argument.+ let unguarded = ArtifactOffload::new(memory_blobs(), "worker", "task");+ let big = "x".repeat(10_000);++ let (text, artifact) = offload_oversized_result(+ big.clone(),+ &unguarded,+ DEFAULT_OFFLOAD_THRESHOLD_BYTES,+ &action_dir,+ Some(&policy),+ )+ .await;++ assert_eq!(text, big, "the inline payload must survive the refusal");+ assert!(artifact.is_none());+ assert!(+ !action_dir.join("outputs").exists(),+ "authorization must happen before an artifact is stored or materialized"+ );+}+#[tokio::test]async fn a_wired_writer_redacts_before_the_bytes_reach_disk() {// `new_artifact_offload` always installs the redactor, so no call site candiff --git a/crates/openhuman-core/src/agent/tinyagents/hosted_error.rs b/crates/openhuman-core/src/agent/tinyagents/hosted_error.rsindex 07b16701b3..59886caa82 100644--- a/crates/openhuman-core/src/agent/tinyagents/hosted_error.rs+++ b/crates/openhuman-core/src/agent/tinyagents/hosted_error.rs@@ -27,21 +27,19 @@ pub(super) fn turn_timeout_bound(bound: TimeoutBound) -> TurnTimeoutBound {/// other hosted error kinds.pub(crate) fn run_error_from_hosted(error: HostedError) -> TinyAgentsError {if matches!(error.kind, HostedErrorKind::Timeout) {- let bound = error- .timeout_bound- .map(turn_timeout_bound)- .unwrap_or(TurnTimeoutBound::RunRemaining);- tracing::debug!(- timeout_bound = bound.tag(),- "[tinyagents] hosted turn timed out; carrying the typed bound"- );- TinyAgentsError::Timeout(format!(- "hosted agent invocation exceeded its {}",- bound.phrase()- ))- } else {- TinyAgentsError::from(error)+ if let Some(timeout_bound) = error.timeout_bound {+ let bound = turn_timeout_bound(timeout_bound);+ tracing::debug!(+ timeout_bound = bound.tag(),+ "[tinyagents] hosted turn timed out; carrying the typed bound"+ );+ return TinyAgentsError::Timeout(format!(+ "hosted agent invocation exceeded its {}",+ bound.phrase()+ ));+ }}+ TinyAgentsError::from(error)}#[cfg(test)]