Skip to content

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

fix(transcript): handle empty transcript in history serialization

Steven Enamakel4f76bcebf8d2
diff --git a/crates/openhuman-core/src/agent/harness/session/transcript_history.rs b/crates/openhuman-core/src/agent/harness/session/transcript_history.rs
index ff4402160c..9262c7f64d 100644
--- a/crates/openhuman-core/src/agent/harness/session/transcript_history.rs
+++ b/crates/openhuman-core/src/agent/harness/session/transcript_history.rs
@@ -353,6 +353,28 @@ impl SessionHistoryLocator for FileTranscriptLocator {
)))
}
+ fn root_for_thread_scoped(
+ &self,
+ thread_id: &str,
+ agent_id: Option<&str>,
+ ) -> Option<Arc<dyn SessionTranscriptRead>> {
+ // Same cross-dir, newest-wins scan as `root_for_thread`, additionally
+ // filtered on `_meta.agent_id` so one runtime agent's resume cannot
+ // pick up a different agent's transcript for a caller-reused
+ // `thread_id` — see `find_root_transcript_for_thread_scoped`.
+ let path =
+ find_root_transcript_for_thread_scoped(&self.workspace_dir, thread_id, agent_id)?;
+ log::debug!(
+ "[transcript-history] locator root_for_thread_scoped thread={thread_id} \
+ agent_id={agent_id:?} path={}",
+ path.display()
+ );
+ Some(Arc::new(SessionTranscriptHistory::opened_at(
+ path,
+ seed_meta_for_discovered(thread_id),
+ )))
+ }
+
fn open_stem(
&self,
stem: &str,