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
Merge remote-tracking branch 'upstream/main' into saas-default-agent-tenant
Steven Enamakel428cafb7c85f
diff --cc crates/openhuman-core/src/profiles/README.mdindex f8ba5647f8,9995282385..30d1bed14c--- a/crates/openhuman-core/src/profiles/README.md+++ b/crates/openhuman-core/src/profiles/README.md@@@ -81,36 -191,18 +191,41 @@@ A profile holds one thread per conversaand would answer `org:<id>` or a minted local root instead.- The autonomy policy is on and supervised, with no auto-approval, no toolinstallation and no trusted roots.-- **`session_agent` stays the profile id.** The default agent was meant to run- with no `session_agent`, as on the desktop. That needs every site that keys- on the acting agent to key on the tenant instead; the approval gate's thread- routes, the MCP host, skill homes, origin delivery and the transcript- fallback still read `agent_scope::current_agent_id()`, so a profile without- an agent id would share their keys with every other profile. Until those- move to `current_tenant`, the profile id doubles as the agent id.+- **The isolation boundary is the profile's `CoreContext`.** It carries the+ forced config, its own security policy (`agent_policy`, never the+ operator's), `profile = <profile id>` (the tenant key: storage scope,+ `/events`, cost, per-thread tables, via `core::runtime::current_tenant`)+ and the user families (threads, channels for web chat, memory), narrowed+ further by `surface::USER_METHODS`. Work for a user runs under it, which is+ what the config loader, the session store and the per-thread caches key on.+- **The default agent has no `session_agent`.** As on the desktop, a+ profile's default agent runs with no agent id: its state sits at the root+ of the profile's own workspace, and its session-store key is+ `<profile>~default` (`core::runtime::session_key`). Every seam that must+ keep users apart keys on the tenant, never on the agent id alone:+ - the approval gate's thread routes (`approval::gate::thread_route_key`:+ the `tenant_key` of the thread under a profile);+ - the MCP host (a profile's host lives at its workspace root; a profile+ never falls back to the process default or a lone open host, and a SaaS+ task with no scope gets none);+ - skill homes (`<workspace>/agents/default/` for a profile's default agent;+ never the operator's `~/.openhuman`, and nothing without a scope);+ - origin delivery and the transcript fallback (the profile's workspace+ root, the same place its file-backed session store writes);+ - web chat keys, in-flight turns, completion owners, event stamps+ (`WebChannelEvent::profile`), storage scopes and the cost ledger, which+ already keyed on the profile.++ What still reads the agent id (`agent_scope::current_agent_id`,+ `CoreContext::session_agent`) is genuinely per agent: `agent_scope_dir` (an+ embedded agent's subdirectory of a workspace), the cost ledger's+ `session_agent` column, owner records for embedded agents (devices, cron+ completions, flows) and log fields.+ - **No ambient fallback.** Tenant-keyed code reads `current_tenant()`, never+ `CoreContext::current()` or `.session_agent()`; `pnpm saas:ambient`+ ratchets the reads that remain (`ambient-context`), alongside bare spawns,+ direct `load_or_init` calls, environment writes and `home_dir()` lookups.+ Detached work uses `spawn_scoped` so it keeps its profile.- **Host tools are opt-in and confined.** A user's context has no `Platform`family, so shell and file tools are absent unless the operator lists theirgroup in `tool_allowlist`:diff --cc crates/openhuman-core/src/security/approval/gate.rsindex 7ab192b7c7,c2b8c7cc00..8563e72346--- a/crates/openhuman-core/src/security/approval/gate.rs+++ b/crates/openhuman-core/src/security/approval/gate.rs@@@ -235,9 -255,10 +268,13 @@@ pub(crate) struct RequestRoutepub(crate) tool_call_id: Option<String>,pub(crate) forced: bool,pub(crate) agent_id: Option<String>,+ /// The [`thread_route_key`] the request was parked under, so a decision+ /// made outside the parking task's scope clears the right route.+ pub(crate) thread_key: Option<String>,+ /// The park can outlive the chat turn it is shown on — an async-delegated+ /// sub-agent routed through the origin fallback (#5499). Carried so the+ /// replay path re-emits the same `detached` flag the live event had.+ pub(crate) detached: bool,}/// Coordinator for pending approvals.diff --cc crates/openhuman-core/src/security/approval/gate_intercept.rsindex cbb5e1b7e9,f0f76be27b..43ec483aa8--- a/crates/openhuman-core/src/security/approval/gate_intercept.rs+++ b/crates/openhuman-core/src/security/approval/gate_intercept.rs@@@ -483,7 -522,7 +525,8 @@@ impl ApprovalGatetool_call_id: tool_call_id.map(str::to_string),forced,agent_id: agent_id.clone(),+ thread_key: thread_key.clone(),+ detached,},);if let Err(err) = store::insert_pending(&self.config, &pending, &self.session_id) {diff --cc crates/openhuman-core/src/security/approval/gate_tests.rsindex 65828447e0,81107d4186..4bf49f3e8d--- a/crates/openhuman-core/src/security/approval/gate_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_tests.rs@@@ -206,8 -206,8 +206,10 @@@ mod core_flow_testsmod forced_tests;#[path = "gate_origin_intercept_tests.rs"]mod origin_intercept_tests;+#[path = "gate_tenant_tests.rs"]+mod tenant_tests;+ #[path = "gate_subagent_tests.rs"]+ mod subagent_tests;#[path = "gate_triage_tests.rs"]mod triage_tests;#[path = "gate_ttl_and_triage_tests.rs"]