Skip to content

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

feat(journal): record run lineage on turn journal and status

Steven Enamakel0d9c1b6fef13
diff --git a/crates/openhuman-core/src/agent/tinyagents/journal.rs b/crates/openhuman-core/src/agent/tinyagents/journal.rs
index 6e6ff2d76e..a3bc2a1259 100644
--- a/crates/openhuman-core/src/agent/tinyagents/journal.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/journal.rs
@@ -191,6 +191,8 @@ pub(crate) async fn attach_turn_journal(
model: &str,
run_id: RunId,
thread_id: Option<ThreadId>,
+ parent_run_id: Option<RunId>,
+ root_run_id: RunId,
) -> Option<TurnJournal> {
let (journal_store, status_store) = match journal_stores(ctx).await {
Ok(stores) => stores,
@@ -206,7 +208,10 @@ pub(crate) async fn attach_turn_journal(
// `events` was seeded with `with_stream_id(run_id)`, every persisted
// observation's `event_id` is the stable `{run_id}-evt-{offset}`.
let journal: Arc<dyn HarnessEventJournal> = Arc::new(StoreEventJournal::new(journal_store));
- let journal_sink = Arc::new(JournalSink::new(journal, run_id.clone()));
+ let journal_sink = Arc::new(
+ JournalSink::new(journal, run_id.clone())
+ .with_lineage(parent_run_id.clone(), root_run_id.clone()),
+ );
let redacting = RedactingSink::new(journal_sink.clone(), process_env_secrets());
// FanOutSink is the durable-observer composition seam (05.2 adds graph sinks
@@ -219,6 +224,8 @@ pub(crate) async fn attach_turn_journal(
// recording the thread (when known) so list_by_thread answers at run start.
let status_store = Arc::new(status_store);
let mut status = HarnessRunStatus::new(run_id.clone(), ComponentId::new(model.to_string()));
+ status.parent_run_id = parent_run_id;
+ status.root_run_id = root_run_id;
if let Some(thread_id) = thread_id {
status = status.with_thread(thread_id);
}