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
feat(cron): scope morning briefing task fetches to recent tasks
Steven Enamakel922177e7b211
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rsindex d69e290ec2..b2c51ffef8 100644--- a/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_build.rs@@ -439,6 +439,7 @@ impl SessionHostBuilder {post_turn_hooks: self.post_turn_hooks,event_session_id,event_channel,+ task_recency_window: None,thread_id: None,agent_definition_name: agent_definition_name.clone(),// Canonical registry id — captured here at build timediff --git a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rsindex 28a5c4948b..c444a9d1c0 100644--- a/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime/accessors.rs@@ -250,6 +250,12 @@ impl OpenHumanSessionHost {.unwrap_or_default()}+ /// Restricts integration task-fetch tools to tasks touched within `window`+ /// on every later turn of this agent; `None` clears the restriction.+ pub fn set_task_recency_window(&mut self, window: Option<std::time::Duration>) {+ self.task_recency_window = window;+ }+pub fn set_event_context(&mut self, session_id: impl Into<String>, channel: impl Into<String>) {self.event_session_id = session_id.into();self.event_channel = channel.into();diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rsindex f164089b7d..94a2727e12 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs@@ -19,6 +19,7 @@ impl OpenHumanSessionHost {context.origin = origin.cloned();context.progress = self.on_progress.clone();context.thread_id = self.thread_id.clone();+ context.task_recency_window = self.task_recency_window;context.workspace = self.workspace_descriptor.clone();// The web backstop's deadline, when this turn runs under one: the// harness winds down before it instead of being dropped by it.diff --git a/crates/openhuman-core/src/agent/session_host/types.rs b/crates/openhuman-core/src/agent/session_host/types.rsindex e34988ba85..d41d96d7e0 100644--- a/crates/openhuman-core/src/agent/session_host/types.rs+++ b/crates/openhuman-core/src/agent/session_host/types.rs@@ -279,6 +279,10 @@ pub struct OpenHumanSessionHost {pub(super) post_turn_hooks: Vec<Arc<dyn PostTurnHook>>,pub(super) event_session_id: String,pub(super) event_channel: String,+ /// Recency window handed to every turn's run context so integration+ /// task-fetch tools only see recently touched tasks (cron morning+ /// briefing). `None` leaves them unbounded.+ pub(super) task_recency_window: Option<std::time::Duration>,/// Backend/session thread explicitly owned by this agent run. It is kept/// separate from event identity: CLI and worker event sessions are not/// necessarily user conversation threads.diff --git a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs b/crates/openhuman-core/src/agent/tinyagents/host/mod.rsindex c9d6d46523..0b5bce3330 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/mod.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/mod.rs@@ -52,7 +52,7 @@ pub use model_resolver::OpenHumanModelResolver;pub use progress_sink::OpenHumanProgressSink;pub(crate) use run_context::direct_subagent_child;pub use run_context::{- decide_dispatch, DispatchDecision, DispatchInputs, LastTurnUsage, OpenHumanRunContext,+ decide_dispatch, DispatchDecision, DispatchInputs, LastTurnUsage, OpenHumanRunContext, OpenHumanRunExt,SubagentUsageEntry, TurnDispatchState,};pub(crate) use security_gate::with_untrusted_input_turn;diff --git a/crates/openhuman-core/src/cron/scheduler/agent_run.rs b/crates/openhuman-core/src/cron/scheduler/agent_run.rsindex 3951422b5d..9043671cda 100644--- a/crates/openhuman-core/src/cron/scheduler/agent_run.rs+++ b/crates/openhuman-core/src/cron/scheduler/agent_run.rs@@ -164,6 +164,21 @@ pub(super) async fn run_agent_job_for_run(// conversation, with its frozen system prompt and stale tool// names. Every run starts from a fresh prompt instead.start_cron_turn_clean(&mut agent);+ // Morning briefing only: Composio task-fetch tools+ // (Linear/ClickUp/Notion/Asana) surface only recently+ // created/changed tasks. Other cron agents and all chat+ // turns leave the window unset. It rides the run context+ // (`OpenHumanRunExt`), not a task-local.+ if is_morning_briefing_job(job) {+ tracing::debug!(+ job_id = %job.id,+ recency_window_secs = MORNING_BRIEFING_TASK_RECENCY_SECS,+ "[cron] applying morning-briefing task recency window"+ );+ agent.set_task_recency_window(Some(std::time::Duration::from_secs(+ MORNING_BRIEFING_TASK_RECENCY_SECS,+ )));+ }// Scope the run's origin around the turn. A job with no// channel origin runs as `TrustedAutomation { Cron }`: the// approval gate treats it as user-authorized automationdiff --git a/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs b/crates/openhuman-core/src/integrations/composio/action_tool_tests.rsindex c32bc201c3..4ca811d755 100644--- a/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs+++ b/crates/openhuman-core/src/integrations/composio/action_tool_tests.rs@@ -496,7 +496,7 @@ fn deferred_instance_returns_live_config_for_redaction() {// Boxed exactly like `Tool::execute` does.let (live_config, outcome) =- Box::pin(t.execute_unredacted(serde_json::json!({}), None)).await;+ Box::pin(t.execute_unredacted(serde_json::json!({}), None, None)).await;let first = outcome.expect("contract-gate surface is Ok(error result)");assert!(first.is_error && error_text(&first).contains("Input JSON schema"),diff --git a/crates/openhuman-core/src/integrations/composio/mod.rs b/crates/openhuman-core/src/integrations/composio/mod.rsindex a268ad6ed4..b2b682d5df 100644--- a/crates/openhuman-core/src/integrations/composio/mod.rs+++ b/crates/openhuman-core/src/integrations/composio/mod.rs@@ -89,4 +89,3 @@ pub use types::{};/// Product-specific task recency scoping used by the briefing runner.-pub(crate) mod task_recency_context;diff --git a/crates/openhuman-core/src/integrations/composio/tools/execute.rs b/crates/openhuman-core/src/integrations/composio/tools/execute.rsindex 54ac12bf32..9241fae7e7 100644--- a/crates/openhuman-core/src/integrations/composio/tools/execute.rs+++ b/crates/openhuman-core/src/integrations/composio/tools/execute.rs@@ -10,9 +10,8 @@ use serde_json::{json, Value};use super::live_config::live_composio_config;use super::redact::redact_composio_outcome;use crate::agent::harness::definition::SandboxMode;-use crate::agent::tinyagents::host::run_context::sandbox_mode_for_tool;+use crate::agent::tinyagents::host::run_context::{sandbox_mode_for_tool, task_recency_window_for_tool};use crate::config::Config;-use crate::integrations::composio::task_recency_context::current_task_recency_window;use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolResult, ToolRunContext};use super::super::contract::{toolkit_from_slug, ToolScope};@@ -100,7 +99,7 @@ impl Tool for ComposioExecuteTool {ToolCategory::Workflow}async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {- let (config, outcome) = Box::pin(self.execute_unredacted(args, None)).await;+ let (config, outcome) = Box::pin(self.execute_unredacted(args, None, None)).await;redact_composio_outcome(&config, outcome)}async fn execute_with_context(@@ -110,7 +109,12 @@ impl Tool for ComposioExecuteTool {context: Option<&dyn ToolRunContext>,) -> anyhow::Result<ToolResult> {let (config, outcome) =- Box::pin(self.execute_unredacted(args, sandbox_mode_for_tool(context))).await;+ Box::pin(self.execute_unredacted(+ args,+ sandbox_mode_for_tool(context),+ task_recency_window_for_tool(context),+ ))+ .await;redact_composio_outcome(&config, outcome)}}@@ -124,6 +128,7 @@ impl ComposioExecuteTool {&self,args: Value,sandbox_mode: Option<SandboxMode>,+ task_recency_window: Option<std::time::Duration>,) -> (Box<Config>, anyhow::Result<ToolResult>) {let tool = args.get("tool")@@ -256,7 +261,7 @@ impl ComposioExecuteTool {// curated task-fetch slugs. No-op for every other slug and for// normal chat / CLI / JSON-RPC (window unset → None). The// authoritative enforcement is the post-filter on the response below.- let task_window_since = current_task_recency_window().map(|w| {+ let task_window_since = task_recency_window.map(|w| {chrono::Utc::now()- chrono::Duration::from_std(w).unwrap_or_else(|_| chrono::Duration::zero())});