Skip to content

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

test(attachments): cover pdf fallback when documents component is off

Steven Enamakel2640adfadbbd
diff --git a/crates/openhuman-core/src/agent/attachments/provider_tests.rs b/crates/openhuman-core/src/agent/attachments/provider_tests.rs
index aeeecceb91..9a2a0fac7a 100644
--- a/crates/openhuman-core/src/agent/attachments/provider_tests.rs
+++ b/crates/openhuman-core/src/agent/attachments/provider_tests.rs
@@ -654,3 +654,28 @@ fn bare_injected_builder_does_not_load_operator_config() {
.unwrap();
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 {
+ inner: Arc::new(Probe::default()),
+ config: Arc::new(config),
+ profile: ModelProfile::default(),
+ fallback_cache: Mutex::new(Default::default()),
+ };
+ let (text, cacheable) = model
+ .fallback(
+ InputModality::File,
+ "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);
+}