Skip to content

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

chore: files changed crates/openhuman-core/src/memory/backfill.rs,crates/openhuman-core/src/memory/i

Steven Enamakel447fadb7f102
diff --git a/crates/openhuman-core/src/memory/backfill.rs b/crates/openhuman-core/src/memory/backfill.rs
index efa865138c..28fcf5ea95 100644
--- a/crates/openhuman-core/src/memory/backfill.rs
+++ b/crates/openhuman-core/src/memory/backfill.rs
@@ -136,11 +136,20 @@ pub async fn start(
return status(ctx, config).await;
};
let backfiller = driver(ctx.clone(), config, bound.engine)?;
+ let pending = backfiller.status(false).await?;
let run = match backfiller.begin().await {
Ok(run) => run,
Err(error) => return Err(error),
};
- let view = backfiller.status(true).await?;
+ let view = BackfillView {
+ state: BackfillState {
+ phase: BackfillPhase::Running,
+ threads_total: pending.pending_threads,
+ ..BackfillState::default()
+ },
+ pending_threads: pending.pending_threads,
+ pending_turns: pending.pending_turns,
+ };
let task_ctx = ctx.clone();
task_ctx.spawn(async move {
let _guard = guard;
diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rs
index a3f4896924..b05038a2d6 100644
--- a/crates/openhuman-core/src/memory/import.rs
+++ b/crates/openhuman-core/src/memory/import.rs
@@ -256,17 +256,19 @@ async fn launch(
let driver = importer(config, bound.engine, consent, paused);
let begin = {
let driver = driver.clone();
- let mode = mode;
- ctx.spawn_blocking(move || match mode {
- Mode::Import => driver.begin(),
- Mode::Retry => driver.begin_retry(),
- Mode::ResumeRetry => Ok(driver.begin_retry_resume()),
+ ctx.spawn_blocking(move || {
+ let begun = match mode {
+ Mode::Import => driver.begin(),
+ Mode::Retry => driver.begin_retry(),
+ Mode::ResumeRetry => Ok(driver.begin_retry_resume()),
+ };
+ (guard, begun)
})
.await
};
- let begun = match begin {
- Ok(Ok(begun)) => begun,
- Ok(Err(error)) => return Err(import_error(&error)),
+ let (guard, begun) = match begin {
+ Ok((guard, Ok(begun))) => (guard, begun),
+ Ok((_guard, Err(error))) => return Err(import_error(&error)),
Err(error) => return Err(Error::Engine(format!("import start failed: {error}"))),
};
let state = begun.state.clone();
diff --git a/crates/openhuman-core/src/memory/layout_migration/ops.rs b/crates/openhuman-core/src/memory/layout_migration/ops.rs
index d31ac4503f..971c8afc40 100644
--- a/crates/openhuman-core/src/memory/layout_migration/ops.rs
+++ b/crates/openhuman-core/src/memory/layout_migration/ops.rs
@@ -30,6 +30,10 @@ struct ContextSpawner(DispatchCtx);
impl MigrationSpawner for ContextSpawner {
fn spawn(&self, task: MigrationTask) -> std::result::Result<(), String> {
+ if tokio::runtime::Handle::try_current().is_err() {
+ drop(task);
+ return Err("no Tokio runtime is available".to_string());
+ }
self.0.spawn(task);
Ok(())
}