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): move layout migration state machine into tinymemory-tools
Steven Enamakela9540f02a182
diff --git a/crates/openhuman-core/src/memory/bus.rs b/crates/openhuman-core/src/memory/bus.rsindex c1b686210d..abeff2e753 100644--- a/crates/openhuman-core/src/memory/bus.rs+++ b/crates/openhuman-core/src/memory/bus.rs@@ -144,7 +144,7 @@ pub async fn run_system_job(config: &crate::config::Config, job: &str) {super::import::resume_interrupted(config).await;super::layout_migration::tick(config,- std::sync::Arc::new(super::layout_migration::AppHost),+ std::sync::Arc::new(super::layout_migration::AppHost::new(config.clone())),std::sync::Arc::new(super::import::scheduler_paused),);super::lifecycle::jobs::run_due(config).await;diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rsindex 4d6de9f46f..51578ef1b6 100644--- a/crates/openhuman-core/src/memory/import.rs+++ b/crates/openhuman-core/src/memory/import.rs@@ -559,8 +559,8 @@ async fn start_with(// screen the user is, once the import is done.if read_file(&workspace_dir).state.phase == ImportPhase::Done {let started = super::layout_migration::start(- config,- Arc::new(super::layout_migration::AppHost),+ config.clone(),+ Arc::new(super::layout_migration::AppHost::new(config)),// Migration is free: organizing follows a finished import// straight away, free period or not. A shared self-hosted// tree still waits for the takeover consent.diff --git a/crates/openhuman-core/src/memory/layout_migration/app_host_tests.rs b/crates/openhuman-core/src/memory/layout_migration/app_host_tests.rsindex a1753964cb..63db90b6bf 100644--- a/crates/openhuman-core/src/memory/layout_migration/app_host_tests.rs+++ b/crates/openhuman-core/src/memory/layout_migration/app_host_tests.rs@@ -4,8 +4,10 @@ use tinymemory_api::conformance::ReferenceEngine;use tinymemory_api::MemoryEngine;use super::*;+use crate::memory::layout_migration::claim;use crate::memory::engine::install_test_engine_for_root;use crate::memory::layout_migration::service::scan;+use tinymemory_tools::layout_migration::{LayoutHost, Outcome, Trigger};use crate::memory::layout_migration::test_host::{count, fact};const ACCOUNT: &str = "0123456789abcdef01234567";@@ -21,8 +23,8 @@ fn signed_in(tmp: &tempfile::TempDir) -> Config {async fn signed_out_there_is_nothing_to_move() {let tmp = tempfile::tempdir().unwrap();let config = crate::memory::test_fixtures::config_in(&tmp);- assert!(matches!(AppHost.engines(&config), Err(MemoryError::Off(_))));- assert!(!scan(&config, &AppHost).await.unwrap().needed);+ assert!(matches!(AppHost::new(config.clone()).engines(), Err(lm::Error::Off(_))));+ assert!(!scan(&AppHost::new(config.clone())).await.unwrap().needed);}#[tokio::test]@@ -36,12 +38,12 @@ async fn binds_the_legacy_tree_and_the_users_own() {install_test_engine_for_root(&config.workspace_dir, Some(&root), tree.clone());legacy.store(fact("legacy fact")).await.unwrap();- let engines = AppHost.engines(&config).unwrap();+ let engines = AppHost::new(config.clone()).engines().unwrap();assert_eq!(count(&*engines.legacy).await, 1);assert_eq!(count(&*engines.tree).await, 0);- assert!(scan(&config, &AppHost).await.unwrap().needed);+ assert!(scan(&AppHost::new(config.clone())).await.unwrap().needed);- let placement = AppHost.placement(&config).unwrap();+ let placement = AppHost::new(config.clone()).placement().unwrap();assert!(placement.chat_node.to_string().ends_with("ws:main"));assert!(matches!(placement.flows, FlowPlacement::WithRoot));}@@ -56,7 +58,7 @@ fn places_into_the_v3_layout_before_the_switch() {let legacy = crate::memory::scope::MemoryIdentity::root().resolve(&config).layout;- let placement = AppHost.placement(&config).unwrap();+ let placement = AppHost::new(config.clone()).placement().unwrap();assert_ne!(placement.layout, legacy, "chats are pooled at ws:main");assert_eq!(placement.layout.conversations("a").unwrap(),@@ -82,8 +84,8 @@ fn every_account_on_a_self_hosted_engine_shares_one_claim() {Arc::new(ReferenceEngine::new()),);}- let key_a = AppHost.legacy_claim(&a).unwrap().unwrap();- let key_b = AppHost.legacy_claim(&b).unwrap().unwrap();+ let key_a = claim_key(&a).unwrap().unwrap();+ let key_b = claim_key(&b).unwrap().unwrap();assert_eq!(key_a.marker, key_b.marker);assert_eq!(key_a@@ -99,7 +101,7 @@ fn every_account_on_a_self_hosted_engine_shares_one_claim() {assert_eq!(key_a.owner, format!("user:{ACCOUNT}"));let hosted = signed_in(&tmp);- assert!(AppHost.legacy_claim(&hosted).unwrap().is_none());+ assert!(claim_key(&hosted).unwrap().is_none());}#[tokio::test]@@ -112,7 +114,7 @@ async fn the_switch_writes_the_migrated_persons_own_config_fresh() {later.memory.agent_id = Some("changed-later".to_string());later.save().await.unwrap();- AppHost.switch(&snapshot).await.unwrap();+ AppHost::new(snapshot.clone()).switch().await.unwrap();let saved = Config::load_from_config_path(&snapshot.config_path, &snapshot.workspace_dir).await@@ -120,3 +122,63 @@ async fn the_switch_writes_the_migrated_persons_own_config_fresh() {assert!(crate::memory::scope::layout_is_v3(&saved));assert_eq!(saved.memory.agent_id.as_deref(), Some("changed-later"));}++/// The host hands the module its claim: a self-hosted tree is not moved until+/// the user consents, and the account that did not claim it has nothing to+/// move. Fails if the adapter stops passing the claim on.+#[tokio::test]+async fn a_shared_tree_reaches_the_module_as_a_claim() {+ let tmp = tempfile::tempdir().unwrap();+ let mut config = signed_in(&tmp);+ config.memory.engine = CORTEXDB_ENGINE.to_string();+ let root = format!("org:{ACCOUNT}");+ let legacy = Arc::new(ReferenceEngine::new());+ install_test_engine_for_root(&config.workspace_dir, None, legacy.clone());+ install_test_engine_for_root(+ &config.workspace_dir,+ Some(&root),+ Arc::new(ReferenceEngine::new()),+ );+ legacy.store(fact("shared fact")).await.unwrap();++ let host = AppHost::new(config.clone());+ let view = scan(&host).await.unwrap();+ assert!(view.needed && view.shared, "{view:?}");+ let outcome = lm::run(&host, Trigger::Manual { takeover: false }, || async { false })+ .await+ .unwrap();+ assert_eq!(outcome, Outcome::NeedsTakeover);+ assert_eq!(count(&*host.engines().unwrap().tree).await, 0);++ // Another account on the machine took the tree first.+ let key = claim_key(&config).unwrap().unwrap();+ let other = ClaimKey::new(+ key.marker.parent().unwrap().parent().unwrap().parent().unwrap(),+ &key.endpoint,+ "user:fedcba9876543210fedcba98",+ );+ assert!(claim::take(&other).unwrap());+ let view = scan(&host).await.unwrap();+ assert!(!view.needed && view.shared, "{view:?}");+}++#[test]+fn errors_keep_their_wire_codes_across_the_module_boundary() {+ for error in [+ MemoryError::Off("x".into()),+ MemoryError::Unsupported("x".into()),+ MemoryError::invalid("x"),+ MemoryError::Unauthorized("x".into()),+ MemoryError::Unavailable("x".into()),+ MemoryError::InsufficientCredits("[USER_INSUFFICIENT_CREDITS] x".into()),+ MemoryError::Engine("x".into()),+ ] {+ let back = from_module(to_module(error.clone()));+ assert_eq!(back.code(), error.code(), "{error:?}");+ assert_eq!(+ back.is_account_wide(),+ error.is_account_wide(),+ "{error:?}"+ );+ }+}diff --git a/crates/openhuman-core/src/memory/layout_migration/service.rs b/crates/openhuman-core/src/memory/layout_migration/service.rsindex 01f1f08f35..dd4c0bbb42 100644--- a/crates/openhuman-core/src/memory/layout_migration/service.rs+++ b/crates/openhuman-core/src/memory/layout_migration/service.rs@@ -10,20 +10,20 @@//! - [`tick`]: memory's background job, every few minutes. It starts or//! resumes an automatic run, which itself waits for a free period (and,//! on a shared legacy tree, for the user's consent).+//!+//! The state machine is the module's; this file owns the executor side: the+//! spawned task, the run slot per workspace and the import gate.use std::collections::HashSet;use std::path::PathBuf;use std::sync::{Arc, LazyLock, Mutex, PoisonError};-use serde::Serialize;+use tinymemory_tools::layout_migration as lm;-use super::claim;-use super::copy::legacy_present;-use super::job::LayoutHost;-use super::job::{run, Trigger};-use super::state::{self, MigrationState, Phase};+use super::app_host::{from_module, AppHost};+use super::{LayoutHost, MigrationState, MigrationStatus, ScanView, Trigger};use crate::config::Config;-use crate::memory::error::{MemoryError, MemoryResult};+use crate::memory::error::MemoryResult;/// Workspaces with a migration running now.static RUNNING: LazyLock<Mutex<HashSet<PathBuf>>> = LazyLock::new(|| Mutex::new(HashSet::new()));@@ -36,55 +36,14 @@ pub struct StartParams {pub takeover: bool,}-/// What [`scan`] found.-#[derive(Debug, Clone, PartialEq, Eq, Serialize)]-pub struct ScanView {- /// There is legacy memory still to move.- pub needed: bool,- /// The legacy tree may be shared with other accounts, so moving it needs- /// the user's consent.- pub shared: bool,-}--/// [`status`]'s answer.-#[derive(Debug, Clone, PartialEq, Serialize)]-pub struct MigrationStatus {- /// The saved progress.- pub state: MigrationState,- /// A run is going now.- pub running: bool,- /// The app stopped in the middle of a run; it resumes on its own, or the- /// user starts it again.- pub interrupted: bool,-}--/// Whether `config`'s account has legacy memory to move.+/// Whether `host`'s account has legacy memory to move.////// # Errors////// When the state cannot be read, the engines cannot be bound, or the legacy/// tree cannot be read.-pub async fn scan(config: &Config, host: &dyn LayoutHost) -> MemoryResult<ScanView> {- let state = state::load(&config.workspace_dir)?;- let claim = match host.legacy_claim(config) {- // Memory off or signed out: nothing to show.- Err(MemoryError::Off(_)) => None,- claim => claim?,- };- let shared = claim.is_some();- let needed = match state.phase {- Phase::Cleaned => false,- // Another account on this machine took the shared tree.- Phase::Idle if claim.as_ref().map(claim::held_by_other).transpose()? == Some(true) => false,- Phase::Idle if !state.switched => match host.engines(config) {- // Memory off or signed out: nothing to show.- Err(MemoryError::Off(_)) => false,- Err(error) => return Err(error),- Ok(engines) => legacy_present(&*engines.legacy).await?,- },- _ => true,- };- Ok(ScanView { needed, shared })+pub async fn scan(host: &dyn LayoutHost) -> MemoryResult<ScanView> {+ lm::scan(host).await.map_err(from_module)}/// The migration's progress for `config`'s workspace.@@ -93,14 +52,7 @@ pub async fn scan(config: &Config, host: &dyn LayoutHost) -> MemoryResult<ScanVi////// When the state file cannot be read.pub fn status(config: &Config) -> MemoryResult<MigrationStatus> {- let state = state::load(&config.workspace_dir)?;- let running = is_running(config);- let interrupted = !running && matches!(state.phase, Phase::Copying | Phase::Cleaning);- Ok(MigrationStatus {- state,- running,- interrupted,- })+ lm::status(&AppHost::new(config.clone()), is_running(config)).map_err(from_module)}pub(crate) fn is_running(config: &Config) -> bool {@@ -149,7 +101,7 @@ pub fn start(let guard = RunGuard(workspace);crate::core::runtime::spawn_scoped(async move {let _guard = guard;- let outcome = run(&config, host.as_ref(), trigger, || {+ let outcome = lm::run(host.as_ref(), trigger, || {let paused = paused();async move { paused }})@@ -160,27 +112,13 @@ pub fn start(}Err(error) => {tracing::warn!(code = error.code(), "[memory:layout_migration] run failed");- record_failure(&config, &error);+ lm::record_failure(host.as_ref(), &error);}}});true}-/// Saves why a run stopped on an error, so the status shows it.-fn record_failure(config: &Config, error: &MemoryError) {- if let Ok(mut state) = state::load(&config.workspace_dir) {- state.phase = Phase::Paused;- state.error = Some(error.to_string());- if let Err(save) = state::save(&config.workspace_dir, &state) {- tracing::warn!(- code = save.code(),- "[memory:layout_migration] state not saved"- );- }- }-}-/// Puts the items that could not be moved back in line: the next run copies/// again from the start (what was copied replays) and cleans up again.///@@ -188,23 +126,7 @@ fn record_failure(config: &Config, error: &MemoryError) {////// When the state cannot be read or saved, or a run is going now.pub fn retry(config: &Config) -> MemoryResult<MigrationState> {- if is_running(config) {- return Err(MemoryError::invalid("the migration is running"));- }- let mut state = state::load(&config.workspace_dir)?;- state.failures.clear();- state.incomplete.clear();- state.cursor = None;- state.error = None;- if state.switched {- state.caught_up = false;- state.cleaning = false;- }- if state.phase != Phase::Idle {- state.phase = Phase::Paused;- }- state::save(&config.workspace_dir, &state)?;- Ok(state)+ lm::retry(&AppHost::new(config.clone()), is_running(config)).map_err(from_module)}/// Memory's background job: starts or resumes an automatic run unless the@@ -214,16 +136,10 @@ pub fn tick(host: Arc<dyn LayoutHost>,paused: Arc<dyn Fn() -> bool + Send + Sync>,) -> bool {- match state::load(&config.workspace_dir) {- Ok(state)- if state.phase == Phase::Cleaned- && (state.rechecked- || !crate::memory::import::listed_unconfirmed(&config.workspace_dir)) =>- {- false- }- Ok(_) if paused() || is_running(config) => false,- Ok(_) => start(config.clone(), host, Trigger::Auto, paused),+ match lm::is_finished(host.as_ref()) {+ Ok(true) => false,+ Ok(false) if paused() || is_running(config) => false,+ Ok(false) => start(config.clone(), host, Trigger::Auto, paused),Err(error) => {tracing::warn!(code = error.code(),diff --git a/crates/openhuman-core/src/memory/layout_migration/service_tests.rs b/crates/openhuman-core/src/memory/layout_migration/service_tests.rsnew file mode 100644index 0000000000..9b1b1e730f--- /dev/null+++ b/crates/openhuman-core/src/memory/layout_migration/service_tests.rs@@ -0,0 +1,155 @@+use std::sync::atomic::Ordering;+use std::sync::Arc;++use tinymemory_api::MemoryEngine;++use super::*;+use crate::memory::layout_migration::state;+use crate::memory::layout_migration::test_host::{count, fact, FakeHost};++fn never() -> Arc<dyn Fn() -> bool + Send + Sync> {+ Arc::new(|| false)+}++/// Waits (by yielding, not by the clock) for the workspace's run to end.+async fn settle(config: &Config) {+ for _ in 0..100_000 {+ if !is_running(config) {+ return;+ }+ tokio::task::yield_now().await;+ }+ panic!("the run did not end");+}++#[tokio::test]+async fn scan_finds_legacy_memory_and_nothing_after_the_move() {+ let tmp = tempfile::tempdir().unwrap();+ let config = crate::memory::test_fixtures::config_in(&tmp);+ let host = Arc::new(FakeHost::with(3, &config).await);+ assert_eq!(+ scan(host.as_ref()).await.unwrap(),+ ScanView {+ needed: true,+ shared: false+ }+ );+ assert!(start(config.clone(), host.clone(), Trigger::Auto, never()));+ settle(&config).await;+ assert!(!scan(host.as_ref()).await.unwrap().needed);+ assert_eq!(status(&config).unwrap().state.phase, Phase::Cleaned);+}++#[tokio::test]+async fn nothing_to_move_shows_nothing() {+ let tmp = tempfile::tempdir().unwrap();+ let config = crate::memory::test_fixtures::config_in(&tmp);+ let host = FakeHost::with(0, &config).await;+ assert!(!scan(&host).await.unwrap().needed);+}++#[tokio::test]+async fn one_run_per_workspace_at_a_time() {+ let tmp = tempfile::tempdir().unwrap();+ let config = crate::memory::test_fixtures::config_in(&tmp);+ let host = Arc::new(FakeHost::with(200, &config).await);+ assert!(start(config.clone(), host.clone(), Trigger::Auto, never()));+ assert!(+ !start(config.clone(), host.clone(), Trigger::Auto, never()),+ "a second start while one runs starts nothing"+ );+ settle(&config).await;+ assert_eq!(count(host.tree.as_ref()).await, 200);+}++#[tokio::test]+async fn a_stopped_run_reads_as_interrupted_and_a_tick_resumes_it() {+ let tmp = tempfile::tempdir().unwrap();+ let config = crate::memory::test_fixtures::config_in(&tmp);+ let host = Arc::new(FakeHost::with(120, &config).await);+ let mut stopped = state::load(&config.workspace_dir).unwrap();+ stopped.phase = Phase::Copying;+ state::save(&config.workspace_dir, &stopped).unwrap();+ assert!(status(&config).unwrap().interrupted);++ assert!(tick(&config, host.clone(), never()));+ settle(&config).await;+ assert_eq!(status(&config).unwrap().state.phase, Phase::Cleaned);+ assert!(!tick(&config, host, never()), "nothing left to do");+}++#[tokio::test]+async fn nothing_starts_while_an_import_is_unfinished() {+ let tmp = tempfile::tempdir().unwrap();+ let config = crate::memory::test_fixtures::config_in(&tmp);+ let host = Arc::new(FakeHost::with(3, &config).await);+ let path = config+ .workspace_dir+ .join("memory")+ .join("import_state.json");+ std::fs::create_dir_all(path.parent().unwrap()).unwrap();+ std::fs::write(+ &path,+ r#"{"state":{"phase":"running","total":3,"imported":1}}"#,+ )+ .unwrap();+ assert!(crate::memory::import::in_progress(&config));+ assert!(!start(config.clone(), host.clone(), Trigger::Auto, never()));+ assert!(!tick(&config, host.clone(), never()));+ assert_eq!(count(host.tree.as_ref()).await, 0);++ std::fs::write(+ &path,+ r#"{"state":{"phase":"done","total":3,"imported":3}}"#,+ )+ .unwrap();+ assert!(start(config.clone(), host.clone(), Trigger::Auto, never()));+ settle(&config).await;+ assert_eq!(count(host.tree.as_ref()).await, 3);+}++#[tokio::test]+async fn a_tick_starts_nothing_while_background_work_is_paused() {+ let tmp = tempfile::tempdir().unwrap();+ let config = crate::memory::test_fixtures::config_in(&tmp);+ let host = Arc::new(FakeHost::with(3, &config).await);+ assert!(!tick(&config, host.clone(), Arc::new(|| true)));+ assert_eq!(count(host.tree.as_ref()).await, 0);+}++#[tokio::test]+async fn retry_puts_a_lost_copy_back_in_line() {+ let tmp = tempfile::tempdir().unwrap();+ let config = crate::memory::test_fixtures::config_in(&tmp);+ let host = Arc::new(FakeHost::with(4, &config).await);+ host.free.store(true, Ordering::SeqCst);+ assert!(start(config.clone(), host.clone(), Trigger::Auto, never()));+ settle(&config).await;+ assert_eq!(status(&config).unwrap().state.phase, Phase::Cleaned);++ // A legacy item the move did not reach (written after cleanup).+ host.legacy.store(fact("late")).await.unwrap();+ let state = retry(&config).unwrap();+ assert!(!state.caught_up && !state.cleaning);+ assert!(start(+ config.clone(),+ host.clone(),+ Trigger::Manual { takeover: false },+ never()+ ));+ settle(&config).await;+ assert_eq!(count(host.tree.as_ref()).await, 5);+ assert_eq!(count(host.legacy.as_ref()).await, 0);+}++#[tokio::test]+async fn a_damaged_state_file_surfaces_as_the_hosts_engine_error() {+ let tmp = tempfile::tempdir().unwrap();+ let config = crate::memory::test_fixtures::config_in(&tmp);+ std::fs::create_dir_all(config.workspace_dir.join("memory")).unwrap();+ std::fs::write(state::path(&config.workspace_dir), b"{ torn").unwrap();+ let error = status(&config).unwrap_err();+ assert_eq!(error.code(), "ENGINE");+ let host = Arc::new(FakeHost::with(1, &config).await);+ assert!(!tick(&config, host, never()), "a torn state starts nothing");+}diff --git a/crates/openhuman-core/src/memory/layout_migration/test_host.rs b/crates/openhuman-core/src/memory/layout_migration/test_host.rsindex c486b160f2..01d343c634 100644--- a/crates/openhuman-core/src/memory/layout_migration/test_host.rs+++ b/crates/openhuman-core/src/memory/layout_migration/test_host.rs@@ -7,16 +7,17 @@ use tinymemory_api::conformance::ReferenceEngine;use tinymemory_api::{LearningKind, ListRequest, MemoryEngine, MemoryMeta, MetaFilter, Namespace, StoreItem,};+use tinymemory_tools::layout_migration::{+ Engines, FlowPlacement, LayoutHost, LegacyClaim, MigrationStateStore, Placement, Result,+};use tinymemory_tools::MemoryLayout;use super::claim::ClaimKey;-use super::copy::Engines;-use super::job::LayoutHost;-use super::map::{FlowPlacement, Placement};+use super::state::FileStateStore;use crate::config::Config;-use crate::memory::error::{MemoryError, MemoryResult};-/// Two in-memory engines and the switches a real host keeps.+/// Two in-memory engines and the switches a real host keeps, with the real+/// file-backed state of the config's workspace.pub(crate) struct FakeHost {pub(crate) legacy: Arc<ReferenceEngine>,pub(crate) tree: Arc<ReferenceEngine>,@@ -28,10 +29,12 @@ pub(crate) struct FakeHost {pub(crate) free_for: AtomicUsize,/// Written to the legacy tree as the switch happens (a turn racing it).pub(crate) racing_write: Mutex<Option<StoreItem>>,+ store: FileStateStore,+ workspace: std::path::PathBuf,}impl FakeHost {- pub(crate) async fn with(learnings: usize) -> Self {+ pub(crate) async fn with(learnings: usize, config: &Config) -> Self {let legacy = Arc::new(ReferenceEngine::new());for i in 0..learnings {legacy.store(fact(&format!("fact {i}"))).await.unwrap();@@ -44,6 +47,8 @@ impl FakeHost {claim: None,free_for: AtomicUsize::new(usize::MAX),racing_write: Mutex::new(None),+ store: FileStateStore::new(&config.workspace_dir),+ workspace: config.workspace_dir.clone(),}}}@@ -69,28 +74,31 @@ pub(crate) async fn count(engine: &dyn MemoryEngine) -> usize {#[async_trait::async_trait]impl LayoutHost for FakeHost {- fn engines(&self, _: &Config) -> MemoryResult<Engines> {+ fn store(&self) -> &dyn MigrationStateStore {+ &self.store+ }++ fn engines(&self) -> Result<Engines> {Ok(Engines {legacy: self.legacy.clone(),tree: self.tree.clone(),})}- fn placement(&self, _: &Config) -> MemoryResult<Placement> {+ fn placement(&self) -> Result<Placement> {Ok(Placement {- layout: MemoryLayout::new(Namespace::ROOT)- .map_err(|e| MemoryError::invalid(e.to_string()))?,+ layout: MemoryLayout::new(Namespace::ROOT).unwrap(),chat_node: "ws:main".parse().unwrap(),flows: FlowPlacement::WithRoot,split_github_by_repo: false,})}- fn is_switched(&self, _: &Config) -> bool {+ fn is_switched(&self) -> bool {self.switched.load(Ordering::SeqCst)}- async fn switch(&self, _: &Config) -> MemoryResult<()> {+ async fn switch(&self) -> Result<()> {let racing = self.racing_write.lock().unwrap().take();if let Some(item) = racing {self.legacy.store(item).await.unwrap();@@ -99,12 +107,21 @@ impl LayoutHost for FakeHost {Ok(())}- async fn free_now(&self, _: &Config) -> bool {+ async fn free_now(&self) -> bool {let left = self.free_for.fetch_sub(1, Ordering::SeqCst);self.free.load(Ordering::SeqCst) && left > 0}- fn legacy_claim(&self, _: &Config) -> MemoryResult<Option<ClaimKey>> {- Ok(self.claim.clone())+ fn legacy_claim(&self) -> Result<Option<Box<dyn LegacyClaim>>> {+ Ok(self+ .claim+ .clone()+ .map(|key| Box::new(key) as Box<dyn LegacyClaim>))}++ fn listed_unconfirmed(&self) -> bool {+ crate::memory::import::listed_unconfirmed(&self.workspace)+ }++ async fn wait_for_listing(&self) {}}diff --git a/crates/openhuman-core/src/memory/schemas/handlers.rs b/crates/openhuman-core/src/memory/schemas/handlers.rsindex cbe7952e58..aaa3b2f0e5 100644--- a/crates/openhuman-core/src/memory/schemas/handlers.rs+++ b/crates/openhuman-core/src/memory/schemas/handlers.rs@@ -307,7 +307,7 @@ pub(super) fn import_retry_failed(params: Map<String, Value>) -> ControllerFuturpub(super) fn migration_scan(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {parse::<EmptyParams>(params)?;- finish(layout_migration::scan(&load().await?, &layout_migration::AppHost).await)+ finish(layout_migration::scan(&layout_migration::AppHost::new(load().await?)).await)})}@@ -317,7 +317,7 @@ pub(super) fn migration_start(params: Map<String, Value>) -> ControllerFuture {let config = load().await?;let started = layout_migration::start(config.clone(),- std::sync::Arc::new(layout_migration::AppHost),+ std::sync::Arc::new(layout_migration::AppHost::new(config.clone())),layout_migration::Trigger::Manual {takeover: params.takeover,},