Skip to content

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

refactor(core): simplify attachment reference checking

Steven Enamakelfe5abb2ef597
diff --git a/crates/openhuman-core/src/threads/ops/edit.rs b/crates/openhuman-core/src/threads/ops/edit.rs
index 9f4542cd1c..8945c6e56f 100644
--- a/crates/openhuman-core/src/threads/ops/edit.rs
+++ b/crates/openhuman-core/src/threads/ops/edit.rs
@@ -119,7 +119,7 @@ pub async fn edit_message(
let has_existing_refs = request
.attachments
.iter()
- .any(|part| crate::threads::attachments::has_opaque_ref(part));
+ .any(crate::threads::attachments::has_opaque_ref);
let staged_parts = if request.attachments.is_empty() {
Vec::new()
} else if has_existing_refs {
diff --git a/crates/openhuman-core/src/threads/ops/edit_attachment_tests.rs b/crates/openhuman-core/src/threads/ops/edit_attachment_tests.rs
index fbf1968501..7ea9927b6b 100644
--- a/crates/openhuman-core/src/threads/ops/edit_attachment_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_attachment_tests.rs
@@ -145,7 +145,7 @@ async fn editing_an_image_row_restages_only_its_exact_opaque_reference() {
&ctx,
"edit-image-source",
&source.id,
- &[original_ref.clone()],
+ std::slice::from_ref(&original_ref),
)
.await
.unwrap();
@@ -218,8 +218,8 @@ async fn edit_rpc_rejects_an_attachment_ref_owned_by_another_row_before_truncati
AppendConversationMessageRequest {
thread_id: "edit-image-scope".into(),
message: ConversationMessageRecord {
- id: id.into(),
- content: content.into(),
+ id,
+ content,
attachments: Vec::new(),
message_type: "text".into(),
extra_metadata: serde_json::json!({}),