Skip to content

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

fix(threads): stop labelling agent rows with a projected request id

Steven Enamakel79bee06165e4
diff --git a/crates/openhuman-core/src/threads/ops/transcript.rs b/crates/openhuman-core/src/threads/ops/transcript.rs
index ab449a558b..64d8408b5a 100644
--- a/crates/openhuman-core/src/threads/ops/transcript.rs
+++ b/crates/openhuman-core/src/threads/ops/transcript.rs
@@ -112,6 +112,7 @@ async fn attach_voice_note_metadata(
.and_then(serde_json::Value::as_str);
match (request_id, row_request_id) {
(Some(projected), Some(stored)) => projected == stored,
+ (Some(_), None) if sender == "agent" => false,
// User rows are durably written before the core returns its
// request id. Exact text is safe only when unique in this
// thread; repeated messages are left unlabelled.
diff --git a/crates/openhuman-core/src/threads/ops/transcript_tests.rs b/crates/openhuman-core/src/threads/ops/transcript_tests.rs
index 790ab8c8e4..314a8afbd6 100644
--- a/crates/openhuman-core/src/threads/ops/transcript_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/transcript_tests.rs
@@ -209,6 +209,65 @@ async fn transcript_projection_includes_voice_metadata_from_persisted_thread_row
});
assert_eq!(user.and_then(|value| value.pointer("/voiceNote/noteId")), Some(&json!("recording-1")));
assert_eq!(assistant.and_then(|value| value.pointer("/voiceNote/noteId")), Some(&json!("reply-1")));
+
+ let newest_page = transcript_get(
+ &ctx,
+ TranscriptGetRequest {
+ thread_id: THREAD.into(),
+ cursor: None,
+ limit: Some(1),
+ },
+ )
+ .await
+ .unwrap()
+ .value
+ .data
+ .unwrap();
+ assert!(newest_page.items.iter().any(|item| matches!(
+ item,
+ tinyagents_session::transcript::view::DisplayItem::AssistantMessage {
+ content,
+ extra_metadata: Some(metadata),
+ ..
+ } if content == "hi there" && metadata.pointer("/voiceNote/noteId") == Some(&json!("reply-1"))
+ )), "the voice metadata follows the assistant item onto its paginated page");
+
+ blocking::append_message(
+ ctx.clone(),
+ workspace,
+ THREAD.into(),
+ ConversationMessage {
+ id: "user-voice-duplicate".into(),
+ content: "hello".into(),
+ message_type: "text".into(),
+ extra_metadata: json!({"voiceNote": {"noteId": "recording-2"}}),
+ sender: "user".into(),
+ created_at: "2026-10-15T00:00:03Z".into(),
+ },
+ )
+ .await
+ .unwrap();
+ let ambiguous = transcript_get(
+ &ctx,
+ TranscriptGetRequest {
+ thread_id: THREAD.into(),
+ cursor: None,
+ limit: None,
+ },
+ )
+ .await
+ .unwrap()
+ .value
+ .data
+ .unwrap();
+ assert!(ambiguous.items.iter().all(|item| !matches!(
+ item,
+ tinyagents_session::transcript::view::DisplayItem::UserMessage {
+ content,
+ extra_metadata: Some(metadata),
+ ..
+ } if content == "hello" && metadata.get("voiceNote").is_some()
+ )), "repeated identical content is not guessed onto either user row");
}
#[tokio::test]