Skip to content

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

fix(agent): preserve native tool calls in recovered transcripts

Steven Enamakel764624aeffcb
diff --git a/crates/openhuman-core/src/agent/message_convert.rs b/crates/openhuman-core/src/agent/message_convert.rs
index 9b3b4ad3cd..44c98e6609 100644
--- a/crates/openhuman-core/src/agent/message_convert.rs
+++ b/crates/openhuman-core/src/agent/message_convert.rs
@@ -26,7 +26,7 @@ use crate::inference::provider::ChatResponse;
use tinyagents_runtime::transcript::reasoning_from_content;
#[cfg(test)]
use tinyagents_runtime::transcript::{
- message_to_flat_transcript as message_to_chat_message,
+ message_to_display_transcript as message_to_chat_message,
message_to_native_transcript as message_to_native_chat_message, REASONING_EXT_KEY,
};
use tinyagents_session::transcript::TranscriptMessage;
@@ -301,7 +301,7 @@ pub(crate) fn history_to_messages(history: &[TranscriptMessage]) -> Vec<Message>
pub(crate) fn messages_to_history(messages: &[Message]) -> Vec<TranscriptMessage> {
messages
.iter()
- .filter_map(tinyagents_runtime::transcript::message_to_flat_transcript)
+ .filter_map(tinyagents_runtime::transcript::message_to_display_transcript)
.collect()
}
diff --git a/crates/openhuman-core/src/agent/session_host/codec.rs b/crates/openhuman-core/src/agent/session_host/codec.rs
index 5a80421e67..909a6c1e1a 100644
--- a/crates/openhuman-core/src/agent/session_host/codec.rs
+++ b/crates/openhuman-core/src/agent/session_host/codec.rs
@@ -20,6 +20,7 @@ pub struct OpenHumanTranscriptCodec;
impl TranscriptCodec<OpenHumanRunContext> for OpenHumanTranscriptCodec {
fn decode_history(&self, transcript: &SessionTranscript) -> Result<Vec<Message>, RuntimeError> {
+ tinyagents_runtime::transcript::native_transcript_to_messages(&transcript.messages)?;
Ok(message_convert::history_to_messages(&transcript.messages))
}
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
index 6685d45a18..35c6163261 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph/transcript.rs
@@ -26,9 +26,11 @@ pub(super) fn failed_run_history(
let base = snapshot.request_base_len.min(snapshot.messages.len());
let end = snapshot.accepted_end();
let mut recovered = original.to_vec();
- recovered.extend(crate::agent::message_convert::messages_to_history(
- &snapshot.messages[base..end],
- ));
+ recovered.extend(
+ snapshot.messages[base..end]
+ .iter()
+ .filter_map(tinyagents_runtime::transcript::message_to_native_transcript),
+ );
(
recovered,
crate::agent::tinyagents::render_unanswered_steps(&snapshot.messages[end..]),
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs
index d228cff61d..c64faf532e 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_failed_run_tests.rs
@@ -171,8 +171,15 @@ fn failed_run_history_keeps_the_original_seed_not_the_provider_bound_one() {
"only the accepted round follows the seed: {recovered:?}"
);
let declaration = &recovered[1];
- assert_eq!(declaration.tool_calls.len(), 1, "accepted native rounds retain their declaration");
- assert_eq!(declaration.tool_calls[0].id, recovered[2].tool_call_id.as_deref().unwrap_or_default());
+ assert_eq!(
+ declaration.tool_calls.len(),
+ 1,
+ "accepted native rounds retain their declaration"
+ );
+ assert_eq!(
+ declaration.tool_calls[0].id,
+ recovered[2].tool_call_id.as_deref().unwrap_or_default()
+ );
assert!(
unanswered.is_some_and(|steps| steps.contains("round-1")),
"the unanswered round is kept as text"
diff --git a/vendor/tinyagents b/vendor/tinyagents
index 0c59fa1522..39dfd72016 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit 0c59fa15226ffcefba0efe1435584cd309e961cb
+Subproject commit 39dfd72016437ace44f658f487a0d871f06b3a80