Skip to content

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

test(attachments): cover disabled tinydocs fallback through owner wrapper

Steven Enamakel287494ce2ffa
diff --git a/crates/openhuman-core/src/attachments/provider_injected_tests.rs b/crates/openhuman-core/src/attachments/provider_injected_tests.rs
index 05df4b28f0..f1078639f3 100644
--- a/crates/openhuman-core/src/attachments/provider_injected_tests.rs
+++ b/crates/openhuman-core/src/attachments/provider_injected_tests.rs
@@ -1,7 +1,5 @@
use super::tests::Probe;
use super::*;
-#[cfg(feature = "documents")]
-use std::sync::Mutex;
#[tokio::test]
async fn injected_turn_source_uses_bound_workspace_and_explicit_model_facts() {
@@ -111,25 +109,3 @@ fn bare_injected_builder_does_not_load_operator_config() {
assert!(agent.runtime_config().is_none());
}
-#[cfg(feature = "documents")]
-#[tokio::test]
-async fn pdf_attachment_degrades_to_a_note_when_documents_component_is_off() {
- let mut config = Config::default();
- config.components.documents = false;
- let model = AttachmentModel {
- config: Arc::new(config),
- core: None,
- fallback_cache: Mutex::new(Default::default()),
- };
- let (text, cacheable) = model
- .document_fallback(
- "uploads/t/id/brief.pdf",
- "application/pdf",
- b"%PDF-1.4",
- )
- .await
- .unwrap();
- assert!(text.contains("Document extraction is disabled"), "{text}");
- assert!(text.contains("brief.pdf"));
- assert!(!cacheable);
-}
diff --git a/crates/openhuman-core/src/attachments/provider_routing_tests.rs b/crates/openhuman-core/src/attachments/provider_routing_tests.rs
index 66675f4083..3e6faaa030 100644
--- a/crates/openhuman-core/src/attachments/provider_routing_tests.rs
+++ b/crates/openhuman-core/src/attachments/provider_routing_tests.rs
@@ -288,6 +288,48 @@ async fn text_archive_and_unavailable_pdf_dispatch_to_distinct_fallbacks() {
if matches!(&user.content[1], ContentBlock::Document(MediaRef::Path { path, .. }) if path == "note.txt")));
}
+#[cfg(feature = "documents")]
+#[tokio::test]
+async fn disabled_tinydocs_fallback_runs_through_the_owner_wrapper_without_caching() {
+ 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 mut config = (*offline_config(temp.path())).clone();
+ config.components.documents = false;
+ let transport = Arc::new(CaptureModel::new(vec![]));
+ let model = controlled_wrapper(transport.clone(), Arc::new(config), &[]);
+
+ model
+ .invoke(
+ &(),
+ user_request(vec![local_media(
+ InputModality::Document,
+ relative,
+ "application/pdf",
+ )]),
+ )
+ .await
+ .unwrap();
+
+ let captured = transport.requests.lock().unwrap();
+ let Message::User(user) = &captured[0].1.messages[0] else {
+ panic!("expected user message")
+ };
+ assert!(user.content[0]
+ .text()
+ .contains("Document extraction is disabled"));
+ assert!(user.content[0].text().contains("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()
{