Skip to content

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

fix(agent): remove unused subagent host module

Steven Enamakel21f5f9fa2893
diff --git a/crates/openhuman-core/src/agent/subagent_host/mod.rs b/crates/openhuman-core/src/agent/subagent_host/mod.rs
index e00f48b9d9..552a19db22 100644
--- a/crates/openhuman-core/src/agent/subagent_host/mod.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/mod.rs
@@ -49,6 +49,10 @@ mod tool_ranking_tests;
#[path = "lifecycle_tests.rs"]
mod lifecycle_tests;
+#[cfg(test)]
+#[path = "persisted_compat_tests.rs"]
+mod persisted_compat_tests;
+
// Public API — the entry point and the shapes it returns.
pub use autonomous::{
autonomous_iter_cap, subagent_iter_cap_with_autonomous_lift, with_autonomous_iter_cap,
diff --git a/crates/openhuman-core/src/agent/subagent_host/persisted_compat_tests.rs b/crates/openhuman-core/src/agent/subagent_host/persisted_compat_tests.rs
new file mode 100644
index 0000000000..dcf6534112
--- /dev/null
+++ b/crates/openhuman-core/src/agent/subagent_host/persisted_compat_tests.rs
@@ -0,0 +1,75 @@
+//! Persisted sub-agent shapes: `subagent_sessions.json` (durable session store)
+//! and the pause checkpoint. Literal files from the release before the message
+//! type migration (`tests/fixtures/session_compat/`) must keep loading, replay
+//! to the same model messages, and re-serialize to the same JSON, so a binary
+//! of either generation can read what the other wrote.
+//!
+//! Goldens are written only with `OH_REGEN_SESSION_COMPAT=1` and must come
+//! from the pre-migration code.
+
+use std::path::{Path, PathBuf};
+
+use serde_json::Value;
+
+use crate::agent::message_convert::history_to_messages;
+use crate::agent::orchestration::subagent_sessions::types::DurableSubagentSession;
+use crate::agent::subagent_host::SubagentCheckpointData;
+
+fn fixture(name: &str) -> PathBuf {
+ Path::new(concat!(
+ env!("CARGO_MANIFEST_DIR"),
+ "/../../tests/fixtures/session_compat"
+ ))
+ .join(name)
+}
+
+fn read(name: &str) -> String {
+ std::fs::read_to_string(fixture(name)).unwrap_or_else(|error| panic!("{name}: {error}"))
+}
+
+fn check_golden(name: &str, got: &Value) {
+ let path = fixture(name);
+ if std::env::var("OH_REGEN_SESSION_COMPAT").as_deref() == Ok("1") {
+ std::fs::write(&path, serde_json::to_string_pretty(got).unwrap() + "\n").unwrap();
+ }
+ let want: Value = serde_json::from_str(&read(name)).unwrap();
+ assert_eq!(
+ &want, got,
+ "{name}: model view of persisted history drifted"
+ );
+}
+
+#[test]
+fn durable_session_store_loads_replays_and_rewrites_identically() {
+ let raw = read("subagent_sessions.json");
+ let sessions: Vec<DurableSubagentSession> = serde_json::from_str(&raw).expect("load store");
+ let history = sessions[0]
+ .latest_history
+ .as_ref()
+ .expect("latest history persisted");
+ check_golden(
+ "subagent_sessions.golden.json",
+ &serde_json::to_value(history_to_messages(history)).unwrap(),
+ );
+ // The store writes pretty JSON; an unchanged load/save cycle is bytewise
+ // stable, which is what lets an older binary keep reading a newer file.
+ assert_eq!(
+ serde_json::to_string_pretty(&sessions).unwrap(),
+ raw.trim_end()
+ );
+}
+
+#[test]
+fn pause_checkpoint_loads_replays_and_rewrites_identically() {
+ let raw = read("subagent_checkpoint.json");
+ let checkpoint: SubagentCheckpointData = serde_json::from_str(&raw).expect("load checkpoint");
+ check_golden(
+ "subagent_checkpoint.golden.json",
+ &serde_json::to_value(history_to_messages(&checkpoint.history)).unwrap(),
+ );
+ // The legacy `toolkit_override` key is dropped on rewrite; everything else
+ // is stable.
+ let mut want: Value = serde_json::from_str(&raw).unwrap();
+ want.as_object_mut().unwrap().remove("toolkit_override");
+ assert_eq!(serde_json::to_value(&checkpoint).unwrap(), want);
+}