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(agent): read the transcript back off the Tokio worker
Shanue6eea7d39757
diff --git a/src/openhuman/agent/harness/session/turn/session_io_impl_01_part_02.rs b/src/openhuman/agent/harness/session/turn/session_io_impl_01_part_02.rsindex 1f06d6c286..bb7aab2114 100644--- a/src/openhuman/agent/harness/session/turn/session_io_impl_01_part_02.rs+++ b/src/openhuman/agent/harness/session/turn/session_io_impl_01_part_02.rs@@ -190,17 +190,31 @@ impl Agent {// though every message body, id and role matched, which is what the// parity soak flagged as `[session_shadow_read] DIVERGENCE` (#6149).// Read-and-mirror runs here on the same best-effort background task- // that already fully rewrites the journal stream; on a read error,- // skip the mirror for this turn (legacy stays authoritative).- let session_transcript = match transcript::read_transcript(&path) {- Ok(t) => t,- Err(err) => {+ // that already fully rewrites the journal stream. The read itself is+ // synchronous — `fs::read_to_string` plus a JSON parse over the whole+ // append-only JSONL, which grows for the life of the session — so it+ // goes to the blocking pool instead of stalling a Tokio worker for+ // the length of the file. On a read error, skip the mirror for this+ // turn (legacy stays authoritative).+ let read_path = path.clone();+ let read_back =+ tokio::task::spawn_blocking(move || transcript::read_transcript(&read_path)).await;+ let session_transcript = match read_back {+ Ok(Ok(t)) => t,+ Ok(Err(err)) => {log::debug!("[session-store] dual-write skipped: transcript read-back failed for {}: {err:#}",path.display());return;}+ Err(err) => {+ log::debug!(+ "[session-store] dual-write skipped: transcript read-back task failed for {}: {err}",+ path.display()+ );+ return;+ }};if let Err(err) = live::write_live_turn(&workspace, &stem, &session_transcript).await {log::warn!("[session-store] dual-write failed stem={stem}: {err:#}");diff --git a/src/openhuman/agent/session_import/live_tests.rs b/src/openhuman/agent/session_import/live_tests.rsindex 167ee011c1..b8158a4892 100644--- a/src/openhuman/agent/session_import/live_tests.rs+++ b/src/openhuman/agent/session_import/live_tests.rs@@ -315,15 +315,26 @@ async fn in_memory_store_reconstruction_diverges_from_legacy_on_sidecar_metadatalet legacy = read_transcript(&jsonl_path).expect("read legacy transcript");let outcome = shadow_read_compare(ws.path(), stem, &legacy).await;- assert!(- matches!(- outcome,- ShadowReadOutcome::Divergence {- first_diff: Some(_),- ..- }- ),- "the in-memory reconstruction must diverge on the dropped tool-failure marker, got {outcome:?}"++ // Pin the divergence to the tool-failure message specifically. `Some(_)`+ // would also accept a mismatch at any other index — including a count+ // mismatch, which `first_diff` reports as the shorter length — so it could+ // pass for a reason that has nothing to do with the dropped sidecar key.+ // Both sides must render every fixture message, and the first difference+ // must be the `tool` message carrying `openhuman_tool_failure`.+ let rendered = base_messages.len();+ let tool_failure_idx = base_messages+ .iter()+ .position(|m| m.role == "tool")+ .expect("tool message present");+ assert_eq!(+ outcome,+ ShadowReadOutcome::Divergence {+ legacy: rendered,+ shadow: rendered,+ first_diff: Some(tool_failure_idx),+ },+ "the in-memory reconstruction must diverge on the dropped tool-failure marker at index {tool_failure_idx}, with both sides rendering {rendered} messages");}