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
test(session): move resumed-prefix system message test to part 04
Steven Enamakel223880885229
diff --git a/src/openhuman/agent/harness/session/session_tests_part_03_tests.rs b/src/openhuman/agent/harness/session/session_tests_part_03_tests.rsindex d0c0e1e190..47548fb6dd 100644--- a/src/openhuman/agent/harness/session/session_tests_part_03_tests.rs+++ b/src/openhuman/agent/harness/session/session_tests_part_03_tests.rs@@ -703,58 +703,3 @@ async fn a_resumed_transcript_prefix_is_absorbed_into_history() {"third question",],);-}--/// A resumed prefix with no leading system message must not erase this-/// turn's freshly rendered one.-///-/// `bound_cached_transcript_messages` keeps a leading system message only-/// "when present" — a transcript that was never seeded with one (or was-/// truncated ahead of it) hands `absorb_resumed_transcript_prefix` a `cached`-/// prefix with no system entry at all. Unconditionally dropping the current-/// system message(s) in that case would leave `history` with none, which is-/// strictly worse than the stale-but-present one this turn already built.-#[tokio::test]-async fn a_resumed_prefix_without_a_system_message_keeps_the_current_one() {- use crate::openhuman::agent::messages::{ChatMessage, ConversationMessage};-- let workspace = tempfile::TempDir::new().expect("temp workspace");- let canned = crate::openhuman::agent::harness::session::transcript::SessionTranscript {- meta: fake_transcript_meta("thr_resume_no_system"),- messages: vec![- ChatMessage::user("first question"),- ChatMessage::assistant("first answer"),- ],- };- let (mut agent, _handle) = agent_with_fake_locator(workspace.path(), Some(canned));- agent.try_load_session_transcript();-- agent.history = vec![- ConversationMessage::Chat(ChatMessage::system("freshly rendered prompt")),- ConversationMessage::Chat(ChatMessage::user("second question")),- ];-- agent.absorb_resumed_transcript_prefix();-- let rendered: Vec<(&str, &str)> = agent- .history- .iter()- .map(|entry| match entry {- ConversationMessage::Chat(chat) => (chat.role.as_str(), chat.content.as_str()),- other => panic!("expected only Chat entries, got {other:?}"),- })- .collect();- assert_eq!(- rendered,- vec![- ("user", "first question"),- ("assistant", "first answer"),- // The cached prefix supplied no system message, so this turn's- // freshly rendered one must survive rather than being dropped- // unconditionally.- ("system", "freshly rendered prompt"),- ("user", "second question"),- ],- "the current system prompt must be kept when the cached prefix has none"- );-}diff --git a/src/openhuman/agent/harness/session/session_tests_part_04_tests.rs b/src/openhuman/agent/harness/session/session_tests_part_04_tests.rsindex 9b8fc13523..480cab7620 100644--- a/src/openhuman/agent/harness/session/session_tests_part_04_tests.rs+++ b/src/openhuman/agent/harness/session/session_tests_part_04_tests.rs@@ -144,3 +144,58 @@ fn an_unchanged_integration_set_leaves_the_tool_block_byte_stable() {"the same toolkits in a different order produced a different tool block");}+++/// A resumed prefix with no leading system message must not erase this+/// turn's freshly rendered one.+///+/// `bound_cached_transcript_messages` keeps a leading system message only+/// "when present" — a transcript that was never seeded with one (or was+/// truncated ahead of it) hands `absorb_resumed_transcript_prefix` a `cached`+/// prefix with no system entry at all. Unconditionally dropping the current+/// system message(s) in that case would leave `history` with none, which is+/// strictly worse than the stale-but-present one this turn already built.+#[tokio::test]+async fn a_resumed_prefix_without_a_system_message_keeps_the_current_one() {+ use crate::openhuman::agent::messages::{ChatMessage, ConversationMessage};++ let workspace = tempfile::TempDir::new().expect("temp workspace");+ let canned = crate::openhuman::agent::harness::session::transcript::SessionTranscript {+ meta: fake_transcript_meta("thr_resume_no_system"),+ messages: vec![+ ChatMessage::user("first question"),+ ChatMessage::assistant("first answer"),+ ],+ };+ let (mut agent, _handle) = agent_with_fake_locator(workspace.path(), Some(canned));+ agent.try_load_session_transcript();++ agent.history = vec![+ ConversationMessage::Chat(ChatMessage::system("freshly rendered prompt")),+ ConversationMessage::Chat(ChatMessage::user("second question")),+ ];++ agent.absorb_resumed_transcript_prefix();++ let rendered: Vec<(&str, &str)> = agent+ .history+ .iter()+ .map(|entry| match entry {+ ConversationMessage::Chat(chat) => (chat.role.as_str(), chat.content.as_str()),+ other => panic!("expected only Chat entries, got {other:?}"),+ })+ .collect();+ assert_eq!(+ rendered,+ vec![+ ("user", "first question"),+ ("assistant", "first answer"),+ // The cached prefix supplied no system message, so this turn's+ // freshly rendered one must survive rather than being dropped+ // unconditionally.+ ("system", "freshly rendered prompt"),+ ("user", "second question"),+ ],+ "the current system prompt must be kept when the cached prefix has none"+ );+}