Skip to content

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

fix(artifacts): keep artifacts/ readable and events.rs within its line limit

M3gA-Minde5ab986f090f
diff --git a/crates/openhuman-core/src/agent/artifacts/README.md b/crates/openhuman-core/src/agent/artifacts/README.md
index 00d100b64f..c9f24cad2a 100644
--- a/crates/openhuman-core/src/agent/artifacts/README.md
+++ b/crates/openhuman-core/src/agent/artifacts/README.md
@@ -91,9 +91,9 @@ event.
## Persistence
- Metadata root `<workspace_dir>/artifacts/`, created on demand by
- `artifacts_root`. Per account; listed in `WORKSPACE_INTERNAL_DIRS`
- because `meta.json` names the file Download and `read_artifact_bytes`
- follow.
+ `artifacts_root`. Per account. Not in `WORKSPACE_INTERNAL_DIRS`: the
+ agent reads its large tool outputs back from `artifacts/tool-results/`,
+ so a record's `file` is bounded by the escape guard instead.
- `<root>/<id>/meta.json`: pretty-printed `ArtifactMeta`, written
atomically (temp + rename).
- `<root>/<id>/args.json`: verbatim producer-tool args, written by the
diff --git a/crates/openhuman-core/src/agent/artifacts/files.rs b/crates/openhuman-core/src/agent/artifacts/files.rs
index b47e9b916f..f2c13f0952 100644
--- a/crates/openhuman-core/src/agent/artifacts/files.rs
+++ b/crates/openhuman-core/src/agent/artifacts/files.rs
@@ -20,8 +20,8 @@
//! path [`SecurityPolicy::is_always_forbidden`] rejects. That last check is the
//! same floor the agent's own file tools keep when the autonomy policy is off,
//! so a hand-edited record cannot reach further than the agent already could.
-//! With the policy on, `artifacts/` is a workspace-internal dir and the agent
-//! cannot edit the record at all.
+//! (`artifacts/` is deliberately not a workspace-internal dir: the agent reads
+//! its own large tool outputs back from `artifacts/tool-results/`.)
use std::path::{Component, Path, PathBuf};
diff --git a/crates/openhuman-core/src/core/events.rs b/crates/openhuman-core/src/core/events.rs
index 5b50185c7f..0a7cbb7955 100644
--- a/crates/openhuman-core/src/core/events.rs
+++ b/crates/openhuman-core/src/core/events.rs
@@ -822,9 +822,8 @@ pub enum DomainEvent {
/// relative and would otherwise resolve into the wrong
/// `<workspace>/artifacts/` tree.
workspace_dir: String,
- /// The file's name relative to its root: `"deck.pptx"` in the
- /// visible files folder (#5505), or `"<uuid>/deck.pptx"` under
- /// `<workspace>/artifacts/` for a legacy record. The absolute path is reachable via
+ /// File name relative to its root (`"deck.pptx"` in the files folder,
+ /// legacy `"<uuid>/deck.pptx"`); the absolute path is reachable via
/// `ai_get_artifact` so the renderer never needs the
/// workspace root.
path: String,
diff --git a/crates/openhuman-core/src/security/policy/policy_workspace_internal_tests.rs b/crates/openhuman-core/src/security/policy/policy_workspace_internal_tests.rs
index 599a844970..8082d0ad4c 100644
--- a/crates/openhuman-core/src/security/policy/policy_workspace_internal_tests.rs
+++ b/crates/openhuman-core/src/security/policy/policy_workspace_internal_tests.rs
@@ -42,22 +42,6 @@ fn is_workspace_internal_path_blocks_state_dirs() {
assert!(policy.is_workspace_internal_path(&ws.join("codegraph")));
}
-/// #5505: `meta.json` names the file an artifact owns, and Download /
-/// `read_artifact_bytes` follow it, so the artifact metadata store is internal
-/// state. The deliverables themselves live in the visible files folder.
-#[test]
-fn is_workspace_internal_path_blocks_artifact_metadata() {
- let tmp = tempfile::tempdir().expect("tempdir");
- let ws = tmp.path().to_path_buf();
- let policy = SecurityPolicy {
- workspace_dir: ws.clone(),
- action_dir: ws.join("action"),
- ..SecurityPolicy::default()
- };
- assert!(policy.is_workspace_internal_path(&ws.join("artifacts").join("abc").join("meta.json")));
- assert!(!policy.is_workspace_internal_path(&ws.join("action").join("Files").join("deck.pptx")));
-}
-
#[test]
fn is_workspace_internal_path_blocks_state_files() {
let tmp = tempfile::tempdir().expect("tempdir");
diff --git a/crates/openhuman-core/src/security/policy/types.rs b/crates/openhuman-core/src/security/policy/types.rs
index e392b447f8..ed99a16dd9 100644
--- a/crates/openhuman-core/src/security/policy/types.rs
+++ b/crates/openhuman-core/src/security/policy/types.rs
@@ -209,11 +209,6 @@ pub(super) const WORKSPACE_INTERNAL_DIRS: &[&str] = &[
// A removed relay domain may leave encrypted identity/session state in an
// upgraded workspace. Keep that legacy directory private.
"tinyplace",
- // Artifact metadata (`meta.json` names the file an artifact owns, and
- // Download / read_artifact_bytes follow it). The deliverables themselves
- // live in the visible files folder (#5505), so nothing here is an agent
- // work product.
- "artifacts",
];
/// Files directly under `workspace_dir` that hold secrets or persona config