Skip to content

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

chore(session): carry frozen prefix metadata

Steven Enamakel1c17e29a2c73
diff --git a/crates/openhuman-core/src/agent/learning/transcript_ingest/transcript_ingest_tests.rs b/crates/openhuman-core/src/agent/learning/transcript_ingest/transcript_ingest_tests.rs
index 21dc967180..67da8e5c23 100644
--- a/crates/openhuman-core/src/agent/learning/transcript_ingest/transcript_ingest_tests.rs
+++ b/crates/openhuman-core/src/agent/learning/transcript_ingest/transcript_ingest_tests.rs
@@ -189,6 +189,7 @@ fn fake_meta(thread_id: Option<&str>) -> TranscriptMeta {
created: "2026-05-09T11:00:00Z".into(),
updated: "2026-05-09T12:00:00Z".into(),
turn_count: 4,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/agent/session_host/prefix_snapshot.rs b/crates/openhuman-core/src/agent/session_host/prefix_snapshot.rs
index 35ec8012db..40301bd22e 100644
--- a/crates/openhuman-core/src/agent/session_host/prefix_snapshot.rs
+++ b/crates/openhuman-core/src/agent/session_host/prefix_snapshot.rs
@@ -4,8 +4,9 @@
//! `agent::prompts::TieredPrompt::system_messages`) and sent as one leading
//! system message per tier. This helper turns a rendered prompt into that
//! prefix, so `runtime_session` never has to know how many messages a prefix
-//! is. A resumed thread's prefix is restored by the tinyagents session from
-//! the transcript's leading system rows; nothing here re-derives it.
+//! is. A resumed thread's prefix is restored by the tinyagents session using
+//! the transcript's recorded frozen-prefix count (or the legacy generation
+//! fallback); nothing here re-derives it.
use tinyagents_runtime::PrefixSnapshot;
use tinyinference_llm::message::Message;
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs
index 4bf2f09468..fea4edc14c 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_adapter_tests.rs
@@ -328,6 +328,7 @@ fn meta() -> TranscriptMeta {
created: chrono::Utc::now().to_rfc3339(),
updated: chrono::Utc::now().to_rfc3339(),
turn_count: 0,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index 7c24d343e6..7f38d9f750 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -1941,6 +1941,7 @@ impl OpenHumanSessionHost {
created: now.clone(),
updated: now,
turn_count: 0,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/agent/session_import/live_tests.rs b/crates/openhuman-core/src/agent/session_import/live_tests.rs
index cc32c835e4..8fa81ec7b4 100644
--- a/crates/openhuman-core/src/agent/session_import/live_tests.rs
+++ b/crates/openhuman-core/src/agent/session_import/live_tests.rs
@@ -49,6 +49,7 @@ fn meta(thread_id: &str) -> TranscriptMeta {
created: "2024-01-01T00:00:00Z".to_string(),
updated: "2024-01-01T00:05:00Z".to_string(),
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 100,
output_tokens: 50,
cached_input_tokens: 20,
diff --git a/crates/openhuman-core/src/agent/subagent_host/extract_tool.rs b/crates/openhuman-core/src/agent/subagent_host/extract_tool.rs
index b8db841782..a0969ec131 100644
--- a/crates/openhuman-core/src/agent/subagent_host/extract_tool.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/extract_tool.rs
@@ -615,6 +615,7 @@ fn write_extract_transcript(
created: ts_rfc3339.clone(),
updated: ts_rfc3339,
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
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 75c9bfef0f..3d1a72d9d8 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
@@ -95,6 +95,7 @@ pub(super) fn persist_subagent_transcript(
created: now.clone(),
updated: now,
turn_count: 1,
+ prefix_message_count: None,
input_tokens: usage.input_tokens,
output_tokens: usage.output_tokens,
cached_input_tokens: usage.cached_input_tokens,
diff --git a/crates/openhuman-core/src/config/migrations/mod_tests.rs b/crates/openhuman-core/src/config/migrations/mod_tests.rs
index 51ae93df90..dbec18d189 100644
--- a/crates/openhuman-core/src/config/migrations/mod_tests.rs
+++ b/crates/openhuman-core/src/config/migrations/mod_tests.rs
@@ -63,6 +63,7 @@ fn meta() -> TranscriptMeta {
created: "2026-05-01T00:00:00Z".into(),
updated: "2026-05-01T00:00:00Z".into(),
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/config/migrations/phase_out_profile_md_tests.rs b/crates/openhuman-core/src/config/migrations/phase_out_profile_md_tests.rs
index 7571b9f8c9..d03881fecc 100644
--- a/crates/openhuman-core/src/config/migrations/phase_out_profile_md_tests.rs
+++ b/crates/openhuman-core/src/config/migrations/phase_out_profile_md_tests.rs
@@ -26,6 +26,7 @@ fn meta() -> TranscriptMeta {
created: "2026-05-01T00:00:00Z".into(),
updated: "2026-05-01T00:00:00Z".into(),
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/threads/ops/edit_tests.rs b/crates/openhuman-core/src/threads/ops/edit_tests.rs
index 36a4309f3e..df08e8a385 100644
--- a/crates/openhuman-core/src/threads/ops/edit_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/edit_tests.rs
@@ -29,6 +29,7 @@ fn base_meta(agent_id: &str, thread_id: &str) -> TranscriptMeta {
created: "2026-09-24T00:00:00Z".into(),
updated: "2026-09-24T00:00:00Z".into(),
turn_count: 0,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/threads/ops/usage_tests.rs b/crates/openhuman-core/src/threads/ops/usage_tests.rs
index a281b96d9c..713102ea57 100644
--- a/crates/openhuman-core/src/threads/ops/usage_tests.rs
+++ b/crates/openhuman-core/src/threads/ops/usage_tests.rs
@@ -23,6 +23,7 @@ fn meta(agent: &str, agent_type: &str, thread_id: Option<&str>) -> TranscriptMet
created: "2026-09-22T00:00:00Z".into(),
updated: "2026-09-22T01:00:00Z".into(),
turn_count: 0,
+ prefix_message_count: None,
// Every fixture leaves the denormalised `_meta` rollups at zero: that is
// exactly what is on disk for every root transcript written since
// `33566d382`, and the aggregate must not depend on them.
diff --git a/crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rs b/crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rs
index 01108507a8..7f8f6e46e5 100644
--- a/crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rs
+++ b/crates/openhuman-core/src/threads/transcript_view/transcript_ordering_tests.rs
@@ -25,6 +25,7 @@ fn meta(thread_id: &str, session_id: Option<String>, parent: Option<String>) ->
created: "2023-11-14T22:00:00+00:00".into(),
updated: "2023-11-14T22:00:00+00:00".into(),
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rs b/crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rs
index 45b7a59d3a..444ac50ec8 100644
--- a/crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rs
+++ b/crates/openhuman-core/src/threads/transcript_view/transcript_view_tests.rs
@@ -461,6 +461,7 @@ fn tool_failure_metadata_round_trips_write_to_display_line() {
created: now.clone(),
updated: now,
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
@@ -542,6 +543,7 @@ fn append_transcript_turn_projects_full_display_shape() {
created: now.clone(),
updated: now,
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 30,
output_tokens: 13,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/threads/transcript_view/transcript_view_tool_round_tests.rs b/crates/openhuman-core/src/threads/transcript_view/transcript_view_tool_round_tests.rs
index 1c2376f3bd..274f760a51 100644
--- a/crates/openhuman-core/src/threads/transcript_view/transcript_view_tool_round_tests.rs
+++ b/crates/openhuman-core/src/threads/transcript_view/transcript_view_tool_round_tests.rs
@@ -149,6 +149,7 @@ fn text_dialect_tool_turn_projects_calls_on_their_issuing_row_as_settled() {
created: "2026-09-24T00:00:00Z".into(),
updated: "2026-09-24T00:00:00Z".into(),
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/threads/turn_state/mirror_tests.rs b/crates/openhuman-core/src/threads/turn_state/mirror_tests.rs
index 645615fe80..7605d0e0b4 100644
--- a/crates/openhuman-core/src/threads/turn_state/mirror_tests.rs
+++ b/crates/openhuman-core/src/threads/turn_state/mirror_tests.rs
@@ -33,6 +33,7 @@ fn seed_root_transcript(workspace: &std::path::Path, thread_id: &str) -> std::pa
created: "2026-07-21T00:00:00Z".into(),
updated: "2026-07-21T00:00:00Z".into(),
turn_count: 1,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
index f27ce042eb..075f66fd1d 100644
--- a/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
+++ b/crates/openhuman-core/src/web_chat/session_checkout_tests.rs
@@ -65,6 +65,7 @@ fn write_thread_transcript(workspace_dir: &Path, stem: &str, thread_id: &str, ro
created: "2026-09-20T15:33:42Z".into(),
updated: "2026-09-20T15:36:32Z".into(),
turn_count: rows.len() / 2,
+ prefix_message_count: None,
input_tokens: 0,
output_tokens: 0,
cached_input_tokens: 0,
diff --git a/vendor/tinyagents b/vendor/tinyagents
index 091eff9c2d..ff80d94140 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit 091eff9c2d2b5971d0c035fa64ebe8dbf2af94f7
+Subproject commit ff80d9414033f3e1241f90faa20a618c3d0ac735