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
fix: preserve cron delivery and direct workflow origins
Steven Enamakel19b3c5271071
diff --git a/crates/openhuman-core/src/channels/proactive.rs b/crates/openhuman-core/src/channels/proactive.rsindex 712d0c621f..9e3f60d262 100644--- a/crates/openhuman-core/src/channels/proactive.rs+++ b/crates/openhuman-core/src/channels/proactive.rs@@ -297,11 +297,12 @@ impl EventHandler<DomainEvent> for ProactiveMessageSubscriber {// task-local turn origin is gone and the gate would deny it// as `Unknown`. The event is host-originated automation// (a cron job's output, a briefing), so label it as such.- let automation_source = if source.starts_with("cron:") {- crate::agent::turn_origin::TrustedAutomationSource::Cron- } else {- crate::agent::turn_origin::TrustedAutomationSource::Background- };+ // This bus task delivers a result to a destination the+ // operator configured. It is distinct from the cron+ // agent turn that produced the result, whose tool calls+ // must remain subject to the cron effect restriction.+ let automation_source =+ crate::agent::turn_origin::TrustedAutomationSource::Background;let (outcome, request_id) = crate::agent::turn_origin::with_origin(crate::agent::turn_origin::AgentTurnOrigin::TrustedAutomation {job_id: source.clone(),diff --git a/crates/openhuman-core/src/security/approval/gate_intercept.rs b/crates/openhuman-core/src/security/approval/gate_intercept.rsindex 534dc9763d..96606fdc81 100644--- a/crates/openhuman-core/src/security/approval/gate_intercept.rs+++ b/crates/openhuman-core/src/security/approval/gate_intercept.rs@@ -55,13 +55,16 @@ impl ApprovalGate {// saved prompt and deliver its answer, not permission for arbitrary// future external effects. Enforce this before global auto-approval,// per-tool allowlists, and per-agent approval bypasses.- if matches!(- &origin,- AgentTurnOrigin::TrustedAutomation {- source: TrustedAutomationSource::Cron,- ..- }- ) {+ if let AgentTurnOrigin::TrustedAutomation {+ source: TrustedAutomationSource::Cron,+ job_id,+ } = &origin+ {+ tracing::warn!(+ tool = tool_name,+ job_id = %job_id,+ "[approval::gate] scheduled agent external effect denied"+ );return (GateOutcome::Deny {reason: format!(diff --git a/crates/openhuman-core/src/security/approval/gate_triage_tests.rs b/crates/openhuman-core/src/security/approval/gate_triage_tests.rsindex 28c4999334..9f0a405acb 100644--- a/crates/openhuman-core/src/security/approval/gate_triage_tests.rs+++ b/crates/openhuman-core/src/security/approval/gate_triage_tests.rs@@ -125,9 +125,8 @@ async fn intercept_with_unknown_origin_denies() {}#[tokio::test]-async fn intercept_with_trusted_cron_origin_allows_without_prompt() {- // Cron jobs the user explicitly authorized run trusted automation;- // the gate allows without prompt and does not persist a row.+async fn intercept_with_trusted_cron_origin_denies_external_effect() {+ // Creating a cron job does not authorize its future tool effects.let (gate, _dir) = test_gate();let origin = AgentTurnOrigin::TrustedAutomation {job_id: "cron-42".into(),@@ -138,10 +137,10 @@ async fn intercept_with_trusted_cron_origin_allows_without_prompt() {gate.intercept("shell", "run ls", serde_json::json!({})),).await;- assert!(matches!(outcome, GateOutcome::Allow));+ assert!(matches!(outcome, GateOutcome::Deny { .. }));assert!(gate.list_pending().unwrap().is_empty(),- "trusted cron must not persist a pending row"+ "denied cron effects must not persist a pending row");}diff --git a/crates/openhuman-core/src/skills/runtime/schemas.rs b/crates/openhuman-core/src/skills/runtime/schemas.rsindex 749dd3a9a0..c4d31516d0 100644--- a/crates/openhuman-core/src/skills/runtime/schemas.rs+++ b/crates/openhuman-core/src/skills/runtime/schemas.rs@@ -267,7 +267,13 @@ fn handle_run(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let payload = deserialize_params::<RunParams>(params)?;tracing::info!(skill_id = %payload.skill_id, "[skill_runtime][rpc] run");- let started = spawn_workflow_run_background(payload.skill_id, payload.inputs).await?;+ let origin = crate::agent::turn_origin::current()+ .unwrap_or(crate::agent::turn_origin::AgentTurnOrigin::Cli);+ let started = crate::agent::turn_origin::with_origin(+ origin,+ spawn_workflow_run_background(payload.skill_id, payload.inputs),+ )+ .await?;to_json(Outcome::new(serde_json::json!({"run_id": started.run_id,diff --git a/crates/openhuman-core/src/skills/schemas/handlers.rs b/crates/openhuman-core/src/skills/schemas/handlers.rsindex c14cbf40d7..c9d8348b0c 100644--- a/crates/openhuman-core/src/skills/schemas/handlers.rs+++ b/crates/openhuman-core/src/skills/schemas/handlers.rs@@ -152,7 +152,13 @@ pub(super) fn handle_skills_recent_runs(params: Map<String, Value>) -> Controllepub(super) fn handle_skills_run(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let payload = deserialize_params::<WorkflowsRunParams>(params)?;- let started = match spawn_workflow_run_background(payload.workflow_id, payload.inputs).await+ let origin = crate::agent::turn_origin::current()+ .unwrap_or(crate::agent::turn_origin::AgentTurnOrigin::Cli);+ let started = match crate::agent::turn_origin::with_origin(+ origin,+ spawn_workflow_run_background(payload.workflow_id, payload.inputs),+ )+ .await{Ok(s) => s,Err(e) => return Err(e),