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(threads): match assistant turns by content when request id is shared
Steven Enamakel7b43caee0716
diff --git a/crates/openhuman-core/src/threads/ops/transcript.rs b/crates/openhuman-core/src/threads/ops/transcript.rsindex dc4ab70bf3..52253ec857 100644--- a/crates/openhuman-core/src/threads/ops/transcript.rs+++ b/crates/openhuman-core/src/threads/ops/transcript.rs@@ -121,7 +121,11 @@ async fn attach_voice_note_metadata(match (request_id, row_request_id) {// A request id identifies the exact turn even when the// transcript decorates the user text with model context.- (Some(projected), Some(stored)) => projected == stored,+ // Assistant turns may contain several messages, so their+ // content still selects the persisted final reply row.+ (Some(projected), Some(stored)) => {+ projected == stored && (sender == "user" || row.content == content)+ }// Legacy rows have no turn identity, so use exact content// only when both sides are legacy.(None, None) => row.content == content,diff --git a/crates/openhuman-core/src/threads/ops/transcript_tests.rs b/crates/openhuman-core/src/threads/ops/transcript_tests.rsindex c56c135bca..83be960f22 100644--- a/crates/openhuman-core/src/threads/ops/transcript_tests.rs+++ b/crates/openhuman-core/src/threads/ops/transcript_tests.rs@@ -85,6 +85,7 @@ async fn write_thread(ctx: &DispatchCtx) {let root_meta = meta("orchestrator", "root");let turn = vec![TranscriptMessage::user("Current Date & Time: today\n\nhello"),+ TranscriptMessage::assistant("Let me think through that."),TranscriptMessage::assistant("hi there"),];locator@@ -196,10 +197,12 @@ async fn transcript_projection_includes_voice_metadata_from_persisted_thread_rowlet decorated_user = "Current Date & Time: today\n\nhello";let prior = vec![TranscriptMessage::user(decorated_user),+ TranscriptMessage::assistant("Let me think through that."),TranscriptMessage::assistant("hi there"),];let complete = vec![TranscriptMessage::user(decorated_user),+ TranscriptMessage::assistant("Let me think through that."),TranscriptMessage::assistant("hi there"),TranscriptMessage::user("hello"),TranscriptMessage::assistant("hi again"),@@ -263,6 +266,14 @@ async fn transcript_projection_includes_voice_metadata_from_persisted_thread_row} if content == "hi there" => extra_metadata.as_ref(),_ => None,});+ let narration = page.items.iter().find_map(|item| match item {+ tinyagents_session::transcript::view::DisplayItem::AssistantMessage {+ content,+ extra_metadata,+ ..+ } if content == "Let me think through that." => extra_metadata.as_ref(),+ _ => None,+ });assert_eq!(voice_user.and_then(|value| value.pointer("/voiceNote/noteId")),Some(&json!("recording-1"))@@ -272,6 +283,7 @@ async fn transcript_projection_includes_voice_metadata_from_persisted_thread_rowassistant.and_then(|value| value.pointer("/voiceNote/noteId")),Some(&json!("reply-1")));+ assert!(narration.is_none_or(|value| value.get("voiceNote").is_none()));let mut cursor = None;let mut voice_reply_on_its_page = false;loop {