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
refactor(subagent_host): remove unused lifecycle persistence helpers
Steven Enamakel391211efeb2b
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle/persistence.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle/persistence.rsindex d6c36fb319..2ab0ae9cc9 100644--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle/persistence.rs+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle/persistence.rs@@ -109,18 +109,6 @@ impl OpenHumanPersistence {.join(format!("task-{}.index.json", Self::task_component(task_id)))}- fn lock_path(&self, key: &SubagentTaskKey) -> std::path::PathBuf {- self.checkpoint_dir- .join("lifecycle")- .join(format!("{}.lock", Self::key_component(key)))- }-- fn index_lock_path(&self, task_id: &str) -> std::path::PathBuf {- self.checkpoint_dir- .join("lifecycle")- .join(format!("task-{}.index.lock", Self::task_component(task_id)))- }-fn task_component(task_id: &str) -> String {let encoded = task_id.as_bytes()@@ -134,30 +122,6 @@ impl OpenHumanPersistence {}}- fn lock_file(path: &std::path::Path) -> Result<std::fs::File, SubagentError> {- let parent = path.parent().expect("lifecycle lock path has a parent");- std::fs::create_dir_all(parent)- .map_err(|error| SubagentError::Persistence(error.to_string()))?;- let file = OpenOptions::new()- .create(true)- .truncate(false)- .read(true)- .write(true)- .open(path)- .map_err(|error| SubagentError::Persistence(error.to_string()))?;- file.lock_exclusive()- .map_err(|error| SubagentError::Persistence(error.to_string()))?;- Ok(file)- }-- fn key_lock(&self, key: &SubagentTaskKey) -> Result<std::fs::File, SubagentError> {- Self::lock_file(&self.lock_path(key))- }-- fn index_lock(&self, task_id: &str) -> Result<std::fs::File, SubagentError> {- Self::lock_file(&self.index_lock_path(task_id))- }-fn read_index_keys(&self, task_id: &str) -> Result<Vec<SubagentTaskKey>, SubagentError> {let raw = match std::fs::read_to_string(self.index_path(task_id)) {Ok(raw) => raw,@@ -186,82 +150,6 @@ impl OpenHumanPersistence {Ok(keys)}- fn write_index_keys(- &self,- task_id: &str,- keys: &[SubagentTaskKey],- ) -> Result<(), SubagentError> {- let path = self.index_path(task_id);- if keys.is_empty() {- match std::fs::remove_file(path) {- Ok(()) => return Ok(()),- Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(()),- Err(error) => return Err(SubagentError::Persistence(error.to_string())),- }- }- Self::replace_file(- &path,- serde_json::to_vec(&serde_json::json!({"keys": keys}))- .map_err(|error| SubagentError::Persistence(error.to_string()))?,- )- }-- fn add_index_key(&self, key: &SubagentTaskKey) -> Result<(), SubagentError> {- let _index_lock = self.index_lock(&key.task_id)?;- let mut keys = self.read_index_keys(&key.task_id)?;- if !keys.contains(key) {- keys.push(key.clone());- self.write_index_keys(&key.task_id, &keys)?;- }- Ok(())- }-- fn remove_index_key(&self, key: &SubagentTaskKey) -> Result<(), SubagentError> {- let _index_lock = self.index_lock(&key.task_id)?;- let mut keys = self.read_index_keys(&key.task_id)?;- keys.retain(|candidate| candidate != key);- self.write_index_keys(&key.task_id, &keys)- }-- fn replace_file(path: &std::path::Path, bytes: Vec<u8>) -> Result<(), SubagentError> {- let parent = path.parent().expect("lifecycle state path has a parent");- std::fs::create_dir_all(parent)- .map_err(|error| SubagentError::Persistence(error.to_string()))?;- let temporary = path.with_extension(format!("{}.tmp", uuid::Uuid::new_v4()));- std::fs::write(&temporary, bytes)- .map_err(|error| SubagentError::Persistence(error.to_string()))?;- match std::fs::rename(&temporary, path) {- Ok(()) => Ok(()),- Err(error) => {- let _ = std::fs::remove_file(&temporary);- Err(SubagentError::Persistence(error.to_string()))- }- }- }-- fn insert_file(path: &std::path::Path, bytes: Vec<u8>) -> Result<bool, SubagentError> {- let parent = path.parent().expect("lifecycle state path has a parent");- std::fs::create_dir_all(parent)- .map_err(|error| SubagentError::Persistence(error.to_string()))?;- let temporary = path.with_extension(format!("{}.tmp", uuid::Uuid::new_v4()));- std::fs::write(&temporary, bytes)- .map_err(|error| SubagentError::Persistence(error.to_string()))?;- match std::fs::hard_link(&temporary, path) {- Ok(()) => {- let _ = std::fs::remove_file(&temporary);- Ok(true)- }- Err(error) if error.kind() == std::io::ErrorKind::AlreadyExists => {- let _ = std::fs::remove_file(&temporary);- Ok(false)- }- Err(error) => {- let _ = std::fs::remove_file(&temporary);- Err(SubagentError::Persistence(error.to_string()))- }- }- }-fn read_pause_checkpoint(&self,key: &SubagentTaskKey,