Skip to content

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

fix(approval): persist agent approval decisions to the store

Steven Enamakel8e65853ffb4c
diff --git a/crates/openhuman-core/src/security/approval/gate_intercept.rs b/crates/openhuman-core/src/security/approval/gate_intercept.rs
index 5d07530977..f9b72e2b9e 100644
--- a/crates/openhuman-core/src/security/approval/gate_intercept.rs
+++ b/crates/openhuman-core/src/security/approval/gate_intercept.rs
@@ -619,7 +619,7 @@ impl ApprovalGate {
gate: self,
request_id: request_id.clone(),
thread_key: thread_key.clone(),
- docs: store::capture_docs(),
+ docs: store::capture_docs(&self.gate.config),
armed: true,
};
diff --git a/crates/openhuman-core/src/security/approval/store.rs b/crates/openhuman-core/src/security/approval/store.rs
index cc94f8fffd..d625ca9bf3 100644
--- a/crates/openhuman-core/src/security/approval/store.rs
+++ b/crates/openhuman-core/src/security/approval/store.rs
@@ -366,8 +366,10 @@ pub fn get_decision(config: &Config, request_id: &str) -> Result<Option<Approval
/// from outside this call's task scope (a `Drop`), where the acting agent is
/// no longer installed. A scope that cannot be resolved is kept as an error,
/// so the later decision fails instead of switching to the SQLite store.
-pub(super) fn capture_docs() -> Result<Option<super::store_documents::Docs>, String> {
- super::store_documents::current().map_err(|error| error.to_string())
+pub(super) fn capture_docs(
+ config: &Config,
+) -> Result<Option<super::store_documents::Docs>, String> {
+ super::store_documents::current(config).map_err(|error| error.to_string())
}
/// [`decide`] against a store captured by [`capture_docs`].
diff --git a/crates/openhuman-core/src/security/approval/store_agent.rs b/crates/openhuman-core/src/security/approval/store_agent.rs
index 2dabb76630..fd38e1bfdf 100644
--- a/crates/openhuman-core/src/security/approval/store_agent.rs
+++ b/crates/openhuman-core/src/security/approval/store_agent.rs
@@ -9,7 +9,7 @@ use super::{Config, PendingApproval};
/// Whether the approval store has been created for `config`'s workspace.
/// A configured document store always exists.
pub fn exists(config: &Config) -> bool {
- matches!(super::super::store_documents::current(), Ok(Some(_)))
+ crate::storage::installed().is_some()
|| super::db_path(config).is_file()
}