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
fix(storage): prune dead-anchor fences before epoch comparison
Steven Enamakel3746e8a50779
diff --git a/crates/openhuman-core/src/profiles/host_tests.rs b/crates/openhuman-core/src/profiles/host_tests.rsindex 517dca9ed0..8d562e0d1f 100644--- a/crates/openhuman-core/src/profiles/host_tests.rs+++ b/crates/openhuman-core/src/profiles/host_tests.rs@@ -522,10 +522,20 @@ async fn provisioning_with_a_new_root_replaces_a_dead_higher_epoch_fence() {.unwrap();assert!(output.status.success(),- "isolated profile fence child failed: {}",+ "isolated profile fence child failed:\n{}\n{}",+ String::from_utf8_lossy(&output.stdout),String::from_utf8_lossy(&output.stderr));- assert!(String::from_utf8_lossy(&output.stdout).contains("test result: ok"));+ let stdout = String::from_utf8_lossy(&output.stdout);+ assert!(+ stdout.contains("running 1 test"),+ "child selected no test: {stdout}"+ );+ assert!(stdout.contains("test profiles::host::tests::provisioning_with_a_new_root_replaces_a_dead_higher_epoch_fence ... ok"), "expected child test did not run: {stdout}");+ assert!(+ stdout.contains("test result: ok. 1 passed"),+ "child did not pass exactly one test: {stdout}"+ );return;}@@ -581,10 +591,20 @@ async fn opening_replaces_a_dropped_hosts_fence_before_cron_reconciliation() {.unwrap();assert!(output.status.success(),- "isolated profile reopen child failed: {}",+ "isolated profile reopen child failed:\n{}\n{}",+ String::from_utf8_lossy(&output.stdout),String::from_utf8_lossy(&output.stderr));- assert!(String::from_utf8_lossy(&output.stdout).contains("test result: ok"));+ let stdout = String::from_utf8_lossy(&output.stdout);+ assert!(+ stdout.contains("running 1 test"),+ "child selected no test: {stdout}"+ );+ assert!(stdout.contains("test profiles::host::tests::opening_replaces_a_dropped_hosts_fence_before_cron_reconciliation ... ok"), "expected child test did not run: {stdout}");+ assert!(+ stdout.contains("test result: ok. 1 passed"),+ "child did not pass exactly one test: {stdout}"+ );return;}diff --git a/crates/openhuman-core/src/storage/fence.rs b/crates/openhuman-core/src/storage/fence.rsindex afc02483f9..a3457ec99f 100644--- a/crates/openhuman-core/src/storage/fence.rs+++ b/crates/openhuman-core/src/storage/fence.rs@@ -287,6 +287,14 @@ impl LeaseFence {.is_none_or(|anchor| anchor.strong_count() > 0)}+ fn has_dead_anchor(&self) -> bool {+ self.anchor+ .lock()+ .unwrap_or_else(PoisonError::into_inner)+ .as_ref()+ .is_some_and(|anchor| anchor.strong_count() == 0)+ }+/// The checks that need no I/O: the latch, and the grant's expiry by/// this node's clock less the margin.///@@ -388,6 +396,10 @@ impl FenceRegistry {/// one is from a newer epoch.pub fn register(&self, fence: Arc<LeaseFence>) {let mut fences = self.lock();+ // A dead anchor means no work can still write through the old grant.+ // Prune it before comparing epochs because a fresh lease store may+ // restart its epoch counter while a stale registry entry remains.+ fences.retain(|held| !held.has_dead_anchor());// A fence from a newer epoch is never displaced by an older grant's.if fences.iter()