Skip to content

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

refactor(core): consolidate memory exit into runtime shutdown

Steven Enamakel0a15ad44405d
diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rs
index 185c78e299..3b73fb1118 100644
--- a/crates/openhuman-core/src/core/runtime/builder.rs
+++ b/crates/openhuman-core/src/core/runtime/builder.rs
@@ -766,14 +766,6 @@ impl CoreRuntime {
let _ = local_addr;
}
- /// Mark the start of serving. Arms memory's exit gate for the eventual
- /// exit (and clears one a previous server in this process may have left):
- /// from here on a memory binding built during exit is refused rather than
- /// missed.
- pub fn serving_started(&self) {
- crate::memory::exit::server_starting();
- }
-
/// Cleanup to run once a transport has stopped serving, whether it ended
/// cleanly or with an error.
///
@@ -785,7 +777,9 @@ impl CoreRuntime {
/// model runtime to stop: the user runs Ollama / LM Studio / MLX
/// themselves and OpenHuman never spawns it.
pub async fn exit_cleanup(&self) {
- crate::memory::exit::shutdown_for_exit().await;
+ if let Some(config) = &self.config {
+ let _ = crate::memory::exit::run(config).await;
+ }
log::debug!("[core] shutdown: exit cleanup done (no owned local runtime to stop)");
}
diff --git a/crates/openhuman-rpc/src/server/serve.rs b/crates/openhuman-rpc/src/server/serve.rs
index 2d1dd2fd19..8b16b11a17 100644
--- a/crates/openhuman-rpc/src/server/serve.rs
+++ b/crates/openhuman-rpc/src/server/serve.rs
@@ -169,7 +169,6 @@ pub async fn serve(
});
}
- runtime.serving_started();
// The serve result is held, not propagated, until the exit work below
// has run. A `?` here on a server error would skip the memory teardown