Skip to content

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

test(session_host): assert prefix adoption opens a successor generation

Steven Enamakel5b140ef54c1f
diff --git a/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs b/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
index fc0fdcb7f4..72333cc5d4 100644
--- a/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
@@ -102,25 +102,27 @@ async fn run_imported_history_prefix_regression() {
&& legacy_answer < current_question,
"the live prefix precedes imported rows, followed by this turn"
);
+ let session_ref = tinyagents_session::transcript::SessionRef::scoped(
+ "relay-import-thread",
+ &actual_agent_id,
+ );
+ let original = locator
+ .read_session_transcript(&session_ref.first_generation())
+ .expect("original imported generation")
+ .read_session()
+ .unwrap()
+ .unwrap();
+ assert_eq!(original.messages, imported);
+
+ let head = locator.head_generation(&session_ref);
+ assert_ne!(head, session_ref, "prefix adoption opens a successor generation");
let transcript = locator
- .read_session_transcript(&tinyagents_session::transcript::SessionRef::scoped(
- "relay-import-thread",
- &actual_agent_id,
- ))
+ .read_session_transcript(&head)
.expect("adopted session transcript")
.read_session()
.unwrap()
.unwrap();
- let inferred_system_prefix = transcript
- .messages
- .iter()
- .take_while(|message| message.role == "system")
- .count();
- assert!(
- transcript.meta.prefix_message_count.unwrap_or_default() > 0
- || inferred_system_prefix > 0,
- "the committed system prefix has either an explicit boundary or a legacy-inferable leading system row"
- );
+ assert!(transcript.meta.prefix_message_count.unwrap_or_default() > 0);
assert!(transcript
.tools
.as_ref()