Skip to content

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

chore: files changed crates/openhuman-core/src/agent/attachments/host_tests.rs,crates/openhuman-embe

Steven Enamakel176dc495c91d
diff --git a/crates/openhuman-core/src/agent/attachments/host_tests.rs b/crates/openhuman-core/src/agent/attachments/host_tests.rs
index 883ba9f86e..c34232ca8d 100644
--- a/crates/openhuman-core/src/agent/attachments/host_tests.rs
+++ b/crates/openhuman-core/src/agent/attachments/host_tests.rs
@@ -69,8 +69,9 @@ async fn references_convert_to_image_and_document_blocks() {
.await
.unwrap();
- let message =
- crate::agent::message_convert::user_message_from_text(&format!("{references}what is this?"));
+ let message = crate::agent::message_convert::user_message_from_text(&format!(
+ "{references}what is this?"
+ ));
let Message::User(user) = message else {
panic!("not a user message");
};
diff --git a/crates/openhuman-embed/tests/orchestrator_attachments.rs b/crates/openhuman-embed/tests/orchestrator_attachments.rs
new file mode 100644
index 0000000000..a654800814
--- /dev/null
+++ b/crates/openhuman-embed/tests/orchestrator_attachments.rs
@@ -0,0 +1,45 @@
+//! A turn on a caller-built runtime's orchestrator refuses attachments
+//! rather than run without them: `inference.agent_chat` carries a string.
+
+mod common;
+use std::sync::Arc;
+
+use common::{offline_config, runtime};
+use openhuman_embed::{
+ Core, CoreBuilder, CoreError, DomainSet, HostAttachment, HostKind, ServiceSet,
+};
+
+#[test]
+fn the_orchestrator_refuses_attachments_it_cannot_carry() {
+ runtime().block_on(async {
+ tokio::spawn(async {
+ let built = CoreBuilder::new(HostKind::Library)
+ .config(offline_config())
+ .services(ServiceSet::none())
+ .domains(DomainSet::embedded())
+ .build()
+ .await
+ .unwrap();
+ let core = Core::from_runtime(Arc::new(built));
+ let refused = core
+ .agent()
+ .turn("look")
+ .attach(HostAttachment::new(
+ b"\x89PNG\r\n\x1a\n".to_vec(),
+ "image/png",
+ ))
+ .send()
+ .await
+ .unwrap_err();
+ assert!(
+ matches!(
+ &refused,
+ CoreError::Domain { kind: Some(kind), .. } if kind == "attachments_unsupported"
+ ),
+ "{refused:?}"
+ );
+ })
+ .await
+ .unwrap();
+ });
+}
diff --git a/crates/openhuman-embed/tests/turn_attachments.rs b/crates/openhuman-embed/tests/turn_attachments.rs
index e931889c84..0ebcfc1e23 100644
--- a/crates/openhuman-embed/tests/turn_attachments.rs
+++ b/crates/openhuman-embed/tests/turn_attachments.rs
@@ -1,16 +1,17 @@
//! Files a host attaches to a turn as bytes reach the model with the
-//! message, and a turn that cannot carry them is refused rather than run
-//! without them.
+//! message, ahead of it, and a turn over the configured limits never runs.
+//! The orchestrator's refusal is in `orchestrator_attachments.rs`: a
+//! caller-built runtime needs a process of its own.
mod common;
use common::{chat_requests, offline_config, provider, route, runtime, stub_backend};
-use openhuman_embed::{AgentSpec, CoreError, HostAttachment, Runtime, Workspace};
+use openhuman_embed::{AgentSpec, HostAttachment, Runtime, Workspace};
const PNG: &[u8] = b"\x89PNG\r\n\x1a\n\0\0\0\rIHDRpixels";
const PDF: &[u8] = b"%PDF-1.7\n1 0 obj\n<<>>\nendobj\n";
#[test]
-fn attached_files_reach_the_model_and_the_orchestrator_refuses_them() {
+fn attached_files_reach_the_model_ahead_of_the_message() {
runtime().block_on(async {
tokio::spawn(async {
let backend = stub_backend().await;
@@ -45,7 +46,10 @@ fn attached_files_reach_the_model_and_the_orchestrator_refuses_them() {
let caption = body.find("what are these?").expect("the caption too");
assert!(photo < report && report < caption, "{body}");
assert!(body.contains("image/png") && body.contains("application/pdf"));
- assert!(!body.contains("IHDRpixels"), "raw bytes in the transcript text");
+ assert!(
+ !body.contains("IHDRpixels"),
+ "raw bytes in the transcript text"
+ );
// Over the configured limit: the turn fails before it runs.
let before = chat_requests(&model).await.len();
@@ -59,20 +63,6 @@ fn attached_files_reach_the_model_and_the_orchestrator_refuses_them() {
.unwrap_err();
assert!(refused.to_string().contains("count exceeds"), "{refused}");
assert_eq!(chat_requests(&model).await.len(), before);
-
- // `AGENT_CHAT` carries a string: the orchestrator path refuses.
- let refused = runtime
- .core()
- .agent()
- .turn("look")
- .attach(HostAttachment::new(PNG, "image/png"))
- .send()
- .await
- .unwrap_err();
- assert!(
- matches!(&refused, CoreError::Domain { kind: Some(kind), .. } if kind == "attachments_unsupported"),
- "{refused:?}"
- );
})
.await
.unwrap();