Skip to content

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

feat(agent): add host tool builder and path policy checks

Steven Enamakel08897257256c
diff --git a/crates/openhuman-core/src/agent/session_host/builder/factory.rs b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
index 6418d4ad4f..f62fa8a615 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/factory.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/factory.rs
@@ -1,6 +1,5 @@
//! `OpenHumanSessionHost::from_config` factory methods and internal `build_session_agent_inner` constructor.
-use super::host_tools::derive_turn_workspace_descriptor;
use super::should_synthesize_delegation_tools;
use crate::agent::harness::host_definition::{
AgentDefinitionExt, AgentDefinitionRegistry, NO_TOOLS_SENTINEL,
@@ -152,7 +151,7 @@ impl OpenHumanSessionHost {
host: Option<&super::HostTools>,
session_id: Option<&str>,
) -> Result<Self> {
- let workspace_descriptor = derive_turn_workspace_descriptor();
+ let workspace_descriptor: Option<tinytools::WorkspaceDescriptor> = None;
let runtime: Arc<dyn host_runtime::RuntimeAdapter> = Arc::from(
host_runtime::create_runtime(&config.runtime, config.shell.hide_window)?,
diff --git a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
index 5ea81e9d89..48bfbca049 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs
@@ -361,21 +361,3 @@ impl OpenHumanSessionHost {
)
}
}
-
-/// Binds the embedder's per-turn root as the default cwd, when it exists.
-pub(super) fn derive_turn_workspace_descriptor() -> Option<tinytools::WorkspaceDescriptor> {
- let root = crate::agent::turn_workspace::current()?;
- if !root.is_dir() {
- tracing::warn!(
- root = %root.display(),
- "[turn_workspace] scoped root is not an existing directory — \
- falling back to the shared action_dir cwd for this turn"
- );
- return None;
- }
- tracing::debug!(
- root = %root.display(),
- "[turn_workspace] turn bound to the embedder's per-turn root as default cwd"
- );
- Some(tinytools::WorkspaceDescriptor::new(root).with_policy_id("turn-workspace"))
-}
diff --git a/crates/openhuman-core/src/hooks/ops.rs b/crates/openhuman-core/src/hooks/ops.rs
index 9e2c06c940..5b87dd1090 100644
--- a/crates/openhuman-core/src/hooks/ops.rs
+++ b/crates/openhuman-core/src/hooks/ops.rs
@@ -57,13 +57,7 @@ pub async fn init(config: &crate::config::schema::Config) {
}
fn workspace_roots(config: &crate::config::schema::Config) -> Vec<PathBuf> {
- let mut roots = vec![config.action_dir.clone()];
- if let Some(turn_root) = crate::agent::turn_workspace::current() {
- if !roots.contains(&turn_root) {
- roots.push(turn_root);
- }
- }
- roots
+ vec![config.action_dir.clone()]
}
/// Fire `sessionStart`, returning context the caller should append to the
diff --git a/crates/openhuman-core/src/memory/tools.rs b/crates/openhuman-core/src/memory/tools.rs
index da02d9aaeb..86ce64ab93 100644
--- a/crates/openhuman-core/src/memory/tools.rs
+++ b/crates/openhuman-core/src/memory/tools.rs
@@ -143,7 +143,6 @@ impl CallFacts {
let workspace = context
.and_then(ToolRunContext::workspace_root)
.map(std::path::Path::to_path_buf)
- .or_else(crate::agent::turn_workspace::current)
.unwrap_or_else(|| config.action_dir.clone());
let identity = super::scope::current().unwrap_or_else(|| {
// Outside a scoped turn (a legacy driver), fall back to the
diff --git a/crates/openhuman-core/src/security/policy/path_checks.rs b/crates/openhuman-core/src/security/policy/path_checks.rs
index bff6796ce7..2bc8da8d58 100644
--- a/crates/openhuman-core/src/security/policy/path_checks.rs
+++ b/crates/openhuman-core/src/security/policy/path_checks.rs
@@ -528,21 +528,6 @@ impl SecurityPolicy {
if Self::is_always_forbidden(path) {
return false;
}
- // Per-turn grant (see `agent::turn_workspace`): an embedder that scoped
- // a workspace root for this turn — a workflow run's checkout — trusts
- // it read/write for the turn's duration. Checked alongside the
- // configured roots rather than instead of them, and *after*
- // `is_always_forbidden` above, so a per-turn grant is exactly as strong
- // as a user-configured `TrustedRoot` and no stronger: credential stores
- // and workspace-internal state stay unreachable through it.
- if let Some(turn_root) = crate::agent::turn_workspace::current() {
- let canonical_turn_root = turn_root
- .canonicalize()
- .unwrap_or_else(|_| turn_root.clone());
- if path.starts_with(&turn_root) || path.starts_with(&canonical_turn_root) {
- return true;
- }
- }
self.trusted_roots.iter().any(|root| {
if require_write && root.access != TrustedAccess::ReadWrite {
return false;