The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore(ci): allowlist deliberate local state in storage-bypass check
Steven Enamakel1c2051ded246
diff --git a/crates/openhuman-core/src/config/workspace/state.rs b/crates/openhuman-core/src/config/workspace/state.rsindex 38b2d6fe25..b28795658d 100644--- a/crates/openhuman-core/src/config/workspace/state.rs+++ b/crates/openhuman-core/src/config/workspace/state.rs@@ -1,5 +1,13 @@//! SQLite-backed mtime state store for the vault file watcher.//!+//! **Deliberately local, not on the storage port.** The rows are absolute+//! paths on this machine and the mtimes the local filesystem reported for+//! them. Neither means anything on another host, so a shared backend (a+//! MongoDB behind several cores) would make one machine skip, or re-ingest,+//! files because of what a different machine saw. It stays a per-machine+//! SQLite file; `scripts/ci/check-storage-bypass.mjs` allowlists it with this+//! reason.+//!//! Persists `path → last_mtime_secs` across restarts so the watcher can//! detect real changes on startup without re-ingesting every file from//! scratch. One row per tracked file; the table is created lazily ondiff --git a/crates/openhuman-core/src/desktop/app_state/ops/state_file.rs b/crates/openhuman-core/src/desktop/app_state/ops/state_file.rsindex 6d00d92a36..c864f5b05e 100644--- a/crates/openhuman-core/src/desktop/app_state/ops/state_file.rs+++ b/crates/openhuman-core/src/desktop/app_state/ops/state_file.rs@@ -16,6 +16,12 @@ use std::path::{Path, PathBuf};use std::time::{SystemTime, UNIX_EPOCH};use tempfile::NamedTempFile;+// Deliberately local, not on the storage port: this file holds the local+// encryption key and the keyring consent choice, which decide how secrets are+// stored on this machine and are needed before any storage backend is open+// (bootstrap config comes from env or a file, never from storage). The+// onboarding flags beside them are tiny and per-install. Allowlisted in+// `scripts/ci/check-storage-bypass.mjs`.pub(super) const APP_STATE_FILENAME: &str = "app-state.json";pub(super) static APP_STATE_FILE_LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));diff --git a/crates/openhuman-core/src/desktop/control/ops.rs b/crates/openhuman-core/src/desktop/control/ops.rsindex 99e0e2d710..5fea81e6b5 100644--- a/crates/openhuman-core/src/desktop/control/ops.rs+++ b/crates/openhuman-core/src/desktop/control/ops.rs@@ -108,6 +108,11 @@ struct LocalState {enabled: bool,}+// Deliberately local, not on the storage port: this is the one machine's own+// consent to let the agent drive its desktop. A shared backend would let a+// flag set on one host enable control on another that never consented, and+// corrupt or missing state must keep failing closed. Allowlisted in+// `scripts/ci/check-storage-bypass.mjs`.fn state_path(config: &Config) -> std::path::PathBuf {config.workspace_dirdiff --git a/crates/openhuman-core/src/inference/tokenjuice/savings.rs b/crates/openhuman-core/src/inference/tokenjuice/savings.rsindex 7cb5728822..4fd2ea0294 100644--- a/crates/openhuman-core/src/inference/tokenjuice/savings.rs+++ b/crates/openhuman-core/src/inference/tokenjuice/savings.rs@@ -6,6 +6,11 @@//! tokens as **input** to the LLM the result is being compressed for. Cost uses//! the per-model input price from [`crate::agent::cost`].//!+//! Deliberately local, not on the storage port: the aggregate is one+//! process-global counter (not per user) that is cheap to lose, so a per-agent+//! scoped document would not mean what the number means. Allowlisted in+//! `scripts/ci/check-storage-bypass.mjs`.+//!//! Aggregates are kept process-global and snapshotted to//! `workspace_dir/state/tokenjuice_savings.json` so the dashboard survives//! restarts. The configured default model and snapshot path are installed viadiff --git a/crates/openhuman-core/src/web3/wallet/ops/state.rs b/crates/openhuman-core/src/web3/wallet/ops/state.rsindex 11e9ae618d..34eda0d396 100644--- a/crates/openhuman-core/src/web3/wallet/ops/state.rs+++ b/crates/openhuman-core/src/web3/wallet/ops/state.rs@@ -168,6 +168,13 @@ fn quarantine_corrupted_wallet_state(path: &Path, reason: &str) {}}+// Deliberately local, not on the storage port (for now): this file is paired+// with the OS keychain entry for the encrypted mnemonic and falls back to+// holding that secret itself when no keychain exists. Splitting the metadata+// onto a shared backend while the key material stays on one machine would+// leave a wallet that exists in one place and not the other. It moves with+// the secrets work (`SecretStore`), not as a plain document. Allowlisted in+// `scripts/ci/check-storage-bypass.mjs`.pub(super) fn load_stored_wallet_state_unlocked(config: &Config,) -> Result<Option<StoredWalletState>, String> {diff --git a/scripts/ci/check-storage-bypass.mjs b/scripts/ci/check-storage-bypass.mjsindex 5d6700296b..ec68b727be 100755--- a/scripts/ci/check-storage-bypass.mjs+++ b/scripts/ci/check-storage-bypass.mjs@@ -11,7 +11,7 @@//// Rules (non-test Rust under crates/openhuman-core/src, outside storage/):// sqlite-open rusqlite `Connection::open(` - use the document port-// json-write fs::write / File::create / OpenOptions::new() - a raw file+// json-write fs::write / File::create / OpenOptions::new() / NamedTempFile - a raw file// store; use the document, stream or secret port//// A file may keep a rule when it is the legacy fallback of a store that already@@ -44,7 +44,7 @@ export const RULES = [},{rule: "json-write",- pattern: /\b(?:fs::write|File::create|OpenOptions::new)\s*\(/,+ pattern: /\b(?:fs::write|File::create|OpenOptions::new|NamedTempFile::new_in)\s*\(/,hint: "persist through the storage port, or allowlist it with a reason in ALLOW",},];@@ -68,6 +68,40 @@ export const ALLOW = new Map([},],[`${SRC}platform/cost/tracker.rs`, { rules: ["json-write"], reason: FALLBACK }],+ [`${SRC}agent/orchestration/subagent_sessions/store.rs`, { rules: ["json-write"], reason: FALLBACK }],+ [`${SRC}integrations/composio/file_store.rs`, { rules: ["json-write"], reason: FALLBACK }],+ [+ `${SRC}desktop/control/ops.rs`,+ {+ rules: ["json-write"],+ reason:+ "this machine's own consent to drive its desktop: per-machine, and it must fail closed rather than follow a shared backend to another host",+ },+ ],+ [+ `${SRC}desktop/app_state/ops/state_file.rs`,+ {+ rules: ["json-write"],+ reason:+ "holds the local encryption key and keyring consent, which are needed before any storage backend is open (bootstrap state is never read from storage)",+ },+ ],+ [+ `${SRC}web3/wallet/ops/state.rs`,+ {+ rules: ["json-write"],+ reason:+ "paired with the OS keychain mnemonic (and holds it when there is no keychain): moves with the secrets work, not as a plain document",+ },+ ],+ [+ `${SRC}inference/tokenjuice/savings.rs`,+ {+ rules: ["json-write"],+ reason:+ "one process-global savings counter snapshot, cheap to lose; not per-user data a scope would mean anything for",+ },+ ],]);/** Whether `rule` is allowed in `rel`. */diff --git a/scripts/ci/storage-bypass-baseline.json b/scripts/ci/storage-bypass-baseline.jsonindex 6c0ddaae53..58d1cd7055 100644--- a/scripts/ci/storage-bypass-baseline.json+++ b/scripts/ci/storage-bypass-baseline.json@@ -90,13 +90,6 @@"text": "std::fs::write(&summary_path, &summary)","occurrence": 1},- {- "rule": "json-write",- "path": "crates/openhuman-core/src/agent/orchestration/subagent_sessions/store.rs",- "line": 43,- "text": "fs::write(&tmp_path, raw)",- "occurrence": 1- },{"rule": "json-write","path": "crates/openhuman-core/src/agent/progress_tracing/export.rs",@@ -246,30 +239,30 @@},{"rule": "json-write",- "path": "crates/openhuman-core/src/inference/tokenjuice/savings.rs",- "line": 162,- "text": "if let Err(e) = std::fs::write(path, json) {",+ "path": "crates/openhuman-core/src/integrations/file_storage/tools/download.rs",+ "line": 84,+ "text": "if let Err(e) = tokio::fs::write(&path, &body).await {","occurrence": 1},{"rule": "json-write",- "path": "crates/openhuman-core/src/integrations/composio/file_store.rs",- "line": 85,- "text": "tokio::fs::write(&tmp, &bytes)",+ "path": "crates/openhuman-core/src/memory/files.rs",+ "line": 61,+ "text": "let mut options = std::fs::OpenOptions::new();","occurrence": 1},{"rule": "json-write",- "path": "crates/openhuman-core/src/integrations/file_storage/tools/download.rs",- "line": 84,- "text": "if let Err(e) = tokio::fs::write(&path, &body).await {",+ "path": "crates/openhuman-core/src/memory/layout_migration/claim.rs",+ "line": 103,+ "text": "let temp = tempfile::NamedTempFile::new_in(key.marker.parent().unwrap_or(Path::new(\".\")))?;","occurrence": 1},{"rule": "json-write",- "path": "crates/openhuman-core/src/memory/files.rs",- "line": 61,- "text": "let mut options = std::fs::OpenOptions::new();",+ "path": "crates/openhuman-core/src/memory/local_root.rs",+ "line": 168,+ "text": "let temp = tempfile::NamedTempFile::new_in(dir)?;","occurrence": 1},{