Skip to content

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

fix(cache): handle missing cache directory on first use

Steven Enamakela064fd601546
diff --git a/crates/openhuman-session/src/cache.rs b/crates/openhuman-session/src/cache.rs
index 90c8fb7e5a..c728da7dea 100644
--- a/crates/openhuman-session/src/cache.rs
+++ b/crates/openhuman-session/src/cache.rs
@@ -193,6 +193,24 @@ impl CurrentUserCache {
(elapsed < window).then(|| (entry.error.clone(), entry.consecutive, window - elapsed))
}
+ /// [`Self::suppressed`], mapped to the error a caller should see: a
+ /// rejection is authoritative and returned as-is (a stale-while-revalidate
+ /// caller cannot observe a background result directly, so it must be
+ /// retained until the next read hands it to the owner); anything else
+ /// suppressed under the backoff window comes back as
+ /// [`FetchMeError::Suppressed`].
+ fn suppressed_error(&self, key: &Key) -> Option<FetchMeError> {
+ let (error, consecutive, retry_in) = self.suppressed(key)?;
+ if matches!(error, FetchMeError::Rejected(_)) {
+ return Some(error);
+ }
+ Some(FetchMeError::Suppressed {
+ message: error.message().to_string(),
+ consecutive,
+ retry_in,
+ })
+ }
+
fn staleness(&self, key: &Key) -> (bool, Option<u64>) {
let state = self.lock();
let stale = state.failure.as_ref().is_some_and(|f| f.key == *key);