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_tests.rs,crates/openhuman-core/src/me

Steven Enamakelc725b0fa419d
diff --git a/crates/openhuman-core/src/memory/backfill_tests.rs b/crates/openhuman-core/src/memory/backfill_tests.rs
index ba67a8c6cd..0519a7924d 100644
--- a/crates/openhuman-core/src/memory/backfill_tests.rs
+++ b/crates/openhuman-core/src/memory/backfill_tests.rs
@@ -54,7 +54,7 @@ async fn seed_thread(workspace: &Path, thread_id: &str, messages: &[(&str, &str)
async fn wait_done(config: &Config) -> BackfillView {
for _ in 0..200 {
let view = status(&DispatchCtx::ambient(), config).await.unwrap();
- if view.state.phase != ImportPhase::Running {
+ if view.state.phase != BackfillPhase::Running {
return view;
}
tokio::time::sleep(Duration::from_millis(20)).await;
@@ -132,7 +132,7 @@ async fn stores_past_chats_once_and_skips_what_live_logging_took() {
.await;
let before = status(&DispatchCtx::ambient(), &config).await.unwrap();
- assert_eq!(before.state.phase, ImportPhase::Idle);
+ assert_eq!(before.state.phase, BackfillPhase::Idle);
assert_eq!((before.pending_threads, before.pending_turns), (2, 3));
let started = start(
@@ -144,7 +144,7 @@ async fn stores_past_chats_once_and_skips_what_live_logging_took() {
.unwrap();
assert_eq!(started.state.threads_total, 2);
let done = wait_done(&config).await;
- assert_eq!(done.state.phase, ImportPhase::Done, "{:?}", done.state);
+ assert_eq!(done.state.phase, BackfillPhase::Done, "{:?}", done.state);
assert_eq!(done.state.turns_stored, 3);
assert_eq!(done.state.items_stored, 6);
assert!(done.state.finished_at.is_some());
@@ -267,7 +267,7 @@ async fn batches_are_stored_accepted_and_the_last_one_visible() {
.await
.unwrap();
let done = wait_done(&config).await;
- assert_eq!(done.state.phase, ImportPhase::Done, "{:?}", done.state);
+ assert_eq!(done.state.phase, BackfillPhase::Done, "{:?}", done.state);
assert_eq!(done.state.items_stored, 6);
let waits = engine.waits.lock().unwrap().clone();
diff --git a/crates/openhuman-core/src/memory/import.rs b/crates/openhuman-core/src/memory/import.rs
index 4592cea9cd..a3f4896924 100644
--- a/crates/openhuman-core/src/memory/import.rs
+++ b/crates/openhuman-core/src/memory/import.rs
@@ -159,11 +159,15 @@ pub(crate) fn scheduler_paused() -> bool {
/// Resumes an import the app quit in the middle of, if there is one, under
/// the scheduler's pause and current billing policy.
pub async fn resume_interrupted(ctx: &crate::core::runtime::DispatchCtx, config: &Config) -> bool {
+ let file = read_file(&config.workspace_dir);
+ let free = file.state.phase == ImportPhase::Error
+ && file.paused_for_credits
+ && super::billing::free_period_active(config).await;
resume_interrupted_with(
ctx,
config,
Arc::new(scheduler_paused),
- Arc::new(|config| futures::executor::block_on(super::billing::free_period_active(config))),
+ Arc::new(move |_: &Config| free),
)
.await
}
diff --git a/crates/openhuman-core/src/memory/import_tests.rs b/crates/openhuman-core/src/memory/import_tests.rs
index e0276941ff..8da765a28e 100644
--- a/crates/openhuman-core/src/memory/import_tests.rs
+++ b/crates/openhuman-core/src/memory/import_tests.rs
@@ -1,14 +1,6 @@
use super::*;
use crate::memory::test_fixtures::config_in;
-struct LiveImportReservation(std::path::PathBuf);
-
-impl Drop for LiveImportReservation {
- fn drop(&mut self) {
- release(&self.0);
- }
-}
-
#[test]
fn the_state_file_round_trips_through_the_atomic_store() {
let tmp = tempfile::tempdir().unwrap();
@@ -50,8 +42,8 @@ fn a_running_state_with_no_live_run_reports_interrupted() {
assert_eq!(state.phase, ImportPhase::Error);
assert!(state.error.unwrap().contains("interrupted"));
assert!(
- in_progress(&config),
- "an interrupted import still blocks organizing"
+ !in_progress(&config),
+ "a stale persisted Running phase is not a live import task"
);
}
@@ -143,9 +135,12 @@ async fn a_live_import_blocks_migration_and_does_not_make_a_stale_migration_look
let config = config_in(&tmp);
let host = Arc::new(FakeHost::with(2, &config).await);
let workspace = config.workspace_dir.clone();
- let _reservation = crate::memory::run_slots::IMPORT
- .try_acquire(workspace.clone())
- .expect("the test owns a live import slot");
+ let _reservation = crate::memory::run_slots::reserve(
+ &crate::memory::run_slots::IMPORT,
+ &workspace,
+ &[&crate::memory::run_slots::BACKFILL, &crate::memory::run_slots::MIGRATION],
+ )
+ .expect("the test owns a live import slot");
let mut stale = state::load(&workspace).unwrap();
stale.phase = Phase::Copying;
@@ -164,7 +159,7 @@ async fn a_live_import_blocks_migration_and_does_not_make_a_stale_migration_look
),
"an active import prevents migration from reserving the workspace"
);
- assert!(!layout_migration::service::is_running(&config));
+ assert!(!layout_migration::ops::is_running(&config));
}
#[tokio::test]