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(attachments): treat unsupported media URL schemes as cacheable
Steven Enamakelda01067d1106
diff --git a/crates/openhuman-core/src/attachments/provider_owner.rs b/crates/openhuman-core/src/attachments/provider_owner.rsindex 458707231a..01950369f0 100644--- a/crates/openhuman-core/src/attachments/provider_owner.rs+++ b/crates/openhuman-core/src/attachments/provider_owner.rs@@ -274,6 +274,7 @@ impl MediaHistoryFallback<AttachmentAccessScope> for AttachmentModel {if !error.contains(super::super::SOURCE_MISSING_MARKER)&& !error.contains("attachments are disabled for this origin")&& !error.contains("remote attachment fetch is disabled")+ && !error.contains("unsupported media URL scheme"){return None;}@@ -292,8 +293,7 @@ fn history_source_block(modality: InputModality, source: &str) -> ContentBlock {mime_type: None,}),modality => {- let media = if source.starts_with("data:") || source.contains("://")- {+ let media = if source.starts_with("data:") || source.contains("://") {MediaRef::Url {url: source.to_owned(),media_type: None,@@ -320,10 +320,16 @@ struct OwnedDocumentsExtractor {#[async_trait]impl TextExtractor for OwnedDocumentsExtractor {+ #[cfg(feature = "documents")]fn handles(&self, mime: &str) -> bool {mime == "application/pdf"}+ #[cfg(not(feature = "documents"))]+ fn handles(&self, _: &str) -> bool {+ false+ }+async fn extract(&self, mime: &str, bytes: &[u8]) -> Result<String, String> {let ctx = crate::core::runtime::DispatchCtx::from_weak(self.ctx.as_ref());crate::agent::multimodal::DocumentsTextExtractor { ctx: &ctx }diff --git a/crates/openhuman-core/src/attachments/provider_routing_tests.rs b/crates/openhuman-core/src/attachments/provider_routing_tests.rsindex 0b43820894..cd76d0beac 100644--- a/crates/openhuman-core/src/attachments/provider_routing_tests.rs+++ b/crates/openhuman-core/src/attachments/provider_routing_tests.rs@@ -325,6 +325,42 @@ async fn disabled_tinydocs_fallback_runs_through_the_owner_wrapper_without_cachi.exists());}+#[cfg(not(feature = "documents"))]+#[tokio::test]+async fn pdf_metadata_fallback_is_cacheable_without_the_documents_feature() {+ let temp = tempfile::tempdir().unwrap();+ let relative = "uploads/thread/id/brief.pdf";+ let path = temp.path().join(relative);+ tokio::fs::create_dir_all(path.parent().unwrap())+ .await+ .unwrap();+ tokio::fs::write(&path, b"%PDF-1.4 original bytes")+ .await+ .unwrap();+ let config = offline_config(temp.path());+ let transport = Arc::new(CaptureModel::new(vec![]));+ let model = controlled_wrapper(transport.clone(), config, &[]);+ let request = user_request(vec![local_media(+ InputModality::Document,+ relative,+ "application/pdf",+ )]);++ model.invoke(&(), request.clone()).await.unwrap();+ model.invoke(&(), request).await.unwrap();++ let calls = transport.requests.lock().unwrap();+ assert_eq!(calls.len(), 2);+ assert!(calls.iter().all(|(_, call)| call.messages[0]+ .text()+ .contains("[FILE-ATTACHED: name=\"brief.pdf\"")));+ assert!(path+ .parent()+ .unwrap()+ .join(".openhuman-derived/readout.txt")+ .exists());+}+#[tokio::test]async fn paid_vision_readout_is_reused_across_recreated_wrappers_and_invalidated_by_source_changes(){@@ -561,7 +597,9 @@ async fn unsupported_media_urls_and_oversized_inline_sources_fail_before_inferenmedia_type: "application/octet-stream".into(),})]);let error = model.invoke(&(), oversized).await.unwrap_err();- assert!(error.to_string().contains("attachment exceeds configured file limit"));+ assert!(error+ .to_string()+ .contains("attachment exceeds configured file limit"));// A valid base64 body just over the decoded byte limit must also fail// before legacy materialization or inference.