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(memory): describe migration state as KV-backed
Steven Enamakel5694e142f550
diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rsindex 4d00f57d90..02bc2a9394 100644--- a/crates/openhuman-core/src/memory/import.rs+++ b/crates/openhuman-core/src/memory/import.rs@@ -3,7 +3,7 @@//! The driver (batching, checkpoints, backoff, failed-item list, retry) is//! `tinymemory_integrations::import::Importer`. This file is the host//! adapter around it: the consent gate, the one-run-per-workspace registry,-//! the atomic state file `<workspace>/memory/import_state.json`, the tokio+//! the durable state value `import_state`, the tokio//! clock, the scheduler pause, the credits resume policy, and what follows a//! finished import (organizing the tree).@@ -52,9 +52,9 @@ fn release(workspace_dir: &Path) {.remove(workspace_dir);}-/// The state file, written atomically (staged, synced, renamed): a crash-/// mid-write leaves the previous state, never a torn file that reads back as-/// a fresh start and re-sends everything.+/// The `import_state` value in the memory state KV store. The first read+/// imports a legacy workspace file; later reads and writes use the storage+/// port, so a crash cannot turn a partial file write into a fresh start.pub(crate) struct StateKvCheckpointStore {workspace_dir: PathBuf,}diff --git a/crates/openhuman-core/src/memory/layout_migration/mod.rs b/crates/openhuman-core/src/memory/layout_migration/mod.rsindex 0853849f38..752a30ac5e 100644--- a/crates/openhuman-core/src/memory/layout_migration/mod.rs+++ b/crates/openhuman-core/src/memory/layout_migration/mod.rs@@ -4,7 +4,7 @@//! service) lives in `tinymemory_tools::layout_migration`; this module is the//! OpenHuman host adapter over its two ports://!-//! - [`state`]: the file-backed [`MigrationStateStore`] under the workspace.+//! - [`state`]: the [`MigrationStateStore`] backed by the memory state KV port.//! - [`app_host`]: the [`LayoutHost`] for one account (engine binding,//! placement, the layout switch, the free period), with [`claim`] naming the//! account that takes a legacy tree several accounts share.@@ -23,7 +23,7 @@ mod test_host;pub use app_host::AppHost;pub use service::{retry, scan, start, status, tick, StartParams};-pub use state::StateKvMigrationStore;+pub use state::{FileStateStore, StateKvMigrationStore};pub use tinymemory_tools::layout_migration::{LayoutHost, MigrationState, MigrationStateStore, MigrationStatus, Outcome, Phase, ScanView,Trigger,diff --git a/crates/openhuman-core/src/memory/layout_migration/state.rs b/crates/openhuman-core/src/memory/layout_migration/state.rsindex 7b25a78100..ada4161647 100644--- a/crates/openhuman-core/src/memory/layout_migration/state.rs+++ b/crates/openhuman-core/src/memory/layout_migration/state.rs@@ -1,5 +1,5 @@-//! The migration's state, the `memory`/`state`/`layout_migration` storage-//! value (once `<workspace>/memory/layout_migration.json`).+//! The migration's `layout_migration` value in the memory state KV store.+//! The first read imports the legacy `<workspace>/memory/layout_migration.json`.//!//! Written whole after every page, so a crash leaves the previous state or//! the new one, never a torn value.@@ -29,6 +29,10 @@ pub struct StateKvMigrationStore {workspace_dir: PathBuf,}+/// Backwards-compatible name for [`StateKvMigrationStore`].+#[deprecated(note = "use StateKvMigrationStore; it persists through the memory state KV port")]+pub type FileStateStore = StateKvMigrationStore;+impl StateKvMigrationStore {/// The store of `workspace_dir`.#[must_use]diff --git a/crates/openhuman-core/src/memory/layout_migration/test_host.rs b/crates/openhuman-core/src/memory/layout_migration/test_host.rsindex 367c1425e8..69ec1ad01e 100644--- a/crates/openhuman-core/src/memory/layout_migration/test_host.rs+++ b/crates/openhuman-core/src/memory/layout_migration/test_host.rs@@ -17,7 +17,7 @@ use super::state::StateKvMigrationStore;use crate::config::Config;/// Two in-memory engines and the switches a real host keeps, with the real-/// file-backed state of the config's workspace.+/// state KV value of the config's workspace.pub(crate) struct FakeHost {pub(crate) legacy: Arc<ReferenceEngine>,pub(crate) tree: Arc<ReferenceEngine>,