Skip to content

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

fix(session): preserve transcript order when resuming stable sessions

Steven Enamakelb576b1072ffa
diff --git a/crates/openhuman-core/src/agent/session_host/transcript_resume_stable_tests.rs b/crates/openhuman-core/src/agent/session_host/transcript_resume_stable_tests.rs
index bceaca73d8..9624aeb536 100644
--- a/crates/openhuman-core/src/agent/session_host/transcript_resume_stable_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/transcript_resume_stable_tests.rs
@@ -61,12 +61,6 @@ fn a_legacy_workspace_is_adopted_once_and_the_next_process_resumes_in_place() {
let stem = host.session_id().expect("bound session id");
place_fixture(root.path(), scenario, &stem, "");
legacy_only = tree(root.path(), &thread, &host);
- eprintln!("DBG tree={:?} session={:?}", legacy_only.keys().collect::<Vec<_>>(), host.session);
- let l = super::transcript_compat_tests::store_locator(root.path()); for r in l.thread_transcripts(&thread, None).unwrap().roots { let m = r.transcript.read_session().unwrap().unwrap(); eprintln!("DBG meta sid={:?} thread={:?} agent={:?} n={}", m.meta.session_id, m.meta.thread_id, m.meta.agent_id, m.messages.len()); }
- let seed = l.thread_transcripts(&thread, None).unwrap().roots[0].transcript.read_session().unwrap().unwrap().meta;
- eprintln!("DBG exists={} chain={:?} stem={}", l.session_exists(host.session.as_ref().unwrap()), l.session_chain(host.session.as_ref().unwrap()), tinyagents_session::transcript::session_stem(host.session.as_ref().unwrap()));
- eprintln!("DBG adopt={:?}", l.adopt_legacy(host.session.as_ref().unwrap(), &thread, &seed));
- eprintln!("DBG roots={:?}", l.thread_transcripts(&thread, None).map(|t| t.roots.iter().map(|r| r.stem.clone()).collect::<Vec<_>>()));
assert!(host.resume_bound_session().await.expect("first resume"));
after_first = tree(root.path(), &thread, &host);
}
diff --git a/crates/openhuman-core/src/agent/session_store/splice_fixture.rs b/crates/openhuman-core/src/agent/session_store/splice_fixture.rs
index ef912d504f..5dd9bc88a6 100644
--- a/crates/openhuman-core/src/agent/session_store/splice_fixture.rs
+++ b/crates/openhuman-core/src/agent/session_store/splice_fixture.rs
@@ -8,12 +8,16 @@
use std::sync::Arc;
-use tinyagents_session::port::{InMemorySessionStores, SessionStoreProvider};
+use tinyagents_session::port::{DriverSessionStores, SessionStoreProvider};
use tinyagents_session::transcript::{TranscriptLocator, TranscriptMessage, TranscriptMeta};
-/// A fresh in-memory transcript store, shared by cloning the `Arc`.
+/// A fresh transcript store over the driver ports on memory (the production
+/// store, minus the disk), shared by cloning the `Arc`.
pub(crate) fn memory_locator() -> Arc<dyn TranscriptLocator> {
- InMemorySessionStores::new().for_agent("fixture").transcripts
+ DriverSessionStores::new(Arc::new(crate::storage::MemoryStorage::new()))
+ .expect("driver session stores over memory")
+ .for_agent("fixture")
+ .transcripts
}
/// A thread's head transcript as the model reads it.