Skip to content

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

chore: I don't see an actual diff in your message — the "Diff:" section is empty, and the stat is

Steven Enamakel0e257903241e
diff --git a/crates/openhuman-app/Cargo.lock b/crates/openhuman-app/Cargo.lock
index a3f760a621..0ebb7a12f8 100644
--- a/crates/openhuman-app/Cargo.lock
+++ b/crates/openhuman-app/Cargo.lock
@@ -6787,7 +6787,7 @@ dependencies = [
[[package]]
name = "tinycomputer-bus"
-version = "0.12.0"
+version = "0.13.0"
dependencies = [
"serde",
"serde_json",
diff --git a/crates/openhuman-core/src/modules/site_memory_host.rs b/crates/openhuman-core/src/modules/site_memory_host.rs
index a657fe7d01..f99020385c 100644
--- a/crates/openhuman-core/src/modules/site_memory_host.rs
+++ b/crates/openhuman-core/src/modules/site_memory_host.rs
@@ -182,11 +182,11 @@ async fn config() -> tinybus::Result<crate::config::Config> {
.map_err(|e| method_error(format!("config unavailable: {e}")))
}
-/// Serializes changes to site files and holds the forget epoch: the number of
-/// times any site was forgotten in this process.
-fn guard() -> &'static tokio::sync::Mutex<u64> {
- static GUARD: OnceLock<tokio::sync::Mutex<u64>> = OnceLock::new();
- GUARD.get_or_init(|| tokio::sync::Mutex::new(0))
+/// Serializes changes to site files and holds the forget epochs: for each
+/// workspace, the number of times a site was forgotten in it.
+fn guard() -> &'static tokio::sync::Mutex<HashMap<PathBuf, u64>> {
+ static GUARD: OnceLock<tokio::sync::Mutex<HashMap<PathBuf, u64>>> = OnceLock::new();
+ GUARD.get_or_init(|| tokio::sync::Mutex::new(HashMap::new()))
}
/// Learning switched in Browser settings since the process started, by
@@ -252,13 +252,15 @@ pub async fn forget(
},
None => None,
};
- let mut epoch = guard().lock().await;
+ let mut epochs = guard().lock().await;
// A task still running there would write it all back when it ends; its
// save now carries a stale epoch.
+ let epoch = epochs.entry(config.workspace_dir.clone()).or_insert(0);
*epoch += 1;
+ let epoch = *epoch;
let store = SiteStore::new(sites_dir(&config.workspace_dir));
let forgotten = store.forget(site.as_deref()).await?;
- tracing::debug!(forgotten, epoch = *epoch, "[site-memory-host] forgot sites");
+ tracing::debug!(forgotten, epoch, "[site-memory-host] forgot sites");
Ok(usize::try_from(forgotten).unwrap_or(usize::MAX))
}
@@ -298,14 +300,12 @@ async fn load_site(
config: &crate::config::Config,
request: LoadSiteRequest,
) -> std::io::Result<LoadSiteResponse> {
- let epoch = guard().lock().await;
+ let epochs = guard().lock().await;
+ let epoch = epochs.get(&config.workspace_dir).copied().unwrap_or(0);
let dir = sites_dir(&config.workspace_dir);
sweep(&dir).await;
let memory = SiteStore::new(dir).load(&request.site).await?;
- Ok(LoadSiteResponse {
- memory,
- epoch: *epoch,
- })
+ Ok(LoadSiteResponse { memory, epoch })
}
/// `Save`, under `config`: refused when learning is off or the site was
@@ -314,10 +314,11 @@ async fn save_site(
config: &crate::config::Config,
request: SaveSiteRequest,
) -> std::io::Result<SaveSiteResponse> {
- let epoch = guard().lock().await;
- if request.epoch != *epoch || !learning(config) {
+ let epochs = guard().lock().await;
+ let epoch = epochs.get(&config.workspace_dir).copied().unwrap_or(0);
+ if request.epoch != epoch || !learning(config) {
tracing::debug!(
- stale = request.epoch != *epoch,
+ stale = request.epoch != epoch,
"[site-memory-host] save refused"
);
return Ok(SaveSiteResponse { saved: false });