Skip to content

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

refactor(session_host): drop unused turn parsing helpers

Steven Enamakel4b0504da7810
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs b/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
index 7a68319780..df7c2b781f 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime/turn_helpers.rs
@@ -4,60 +4,12 @@
use super::super::types::OpenHumanSessionHost;
use crate::util::truncate_with_ellipsis;
use tinyagents_harness::agent_error::AgentError;
-use tinytools_agent::dialect::TranscriptEntry;
impl OpenHumanSessionHost {
const EVENT_ERROR_MAX_CHARS: usize = 256;
- // ─────────────────────────────────────────────────────────────────
- // Static helpers for turn parsing + telemetry
- // ─────────────────────────────────────────────────────────────────
-
- pub(in crate::agent::session_host) fn count_iterations(messages: &[TranscriptEntry]) -> usize {
- messages
- .iter()
- .filter(|message| matches!(message, TranscriptEntry::AssistantToolCalls { .. }))
- .count()
- + 1
- }
-
- fn conversation_message_eq(left: &TranscriptEntry, right: &TranscriptEntry) -> bool {
- left == right
- }
-
- fn message_slice_eq(left: &[TranscriptEntry], right: &[TranscriptEntry]) -> bool {
- left.len() == right.len()
- && left
- .iter()
- .zip(right.iter())
- .all(|(left, right)| Self::conversation_message_eq(left, right))
- }
-
- pub(in crate::agent::session_host) fn new_entries_for_turn<'a>(
- history_snapshot: &[TranscriptEntry],
- current_history: &'a [TranscriptEntry],
- ) -> &'a [TranscriptEntry] {
- let common_prefix_len = history_snapshot
- .iter()
- .zip(current_history.iter())
- .take_while(|(left, right)| Self::conversation_message_eq(left, right))
- .count();
-
- if common_prefix_len == history_snapshot.len() {
- return &current_history[common_prefix_len..];
- }
-
- let max_overlap = history_snapshot.len().min(current_history.len());
- for overlap in (0..=max_overlap).rev() {
- let snapshot_suffix = &history_snapshot[history_snapshot.len() - overlap..];
- let current_prefix = &current_history[..overlap];
- if Self::message_slice_eq(snapshot_suffix, current_prefix) {
- return &current_history[overlap..];
- }
- }
-
- current_history
- }
+ // The turn count comes from the durable runtime receipt. This module keeps
+ // only OpenHuman's safe event projection for untyped failures.
pub(in crate::agent::session_host) fn sanitize_event_error_message(
err: &anyhow::Error,