Skip to content

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

feat(schedule): propagate turn origin when creating scheduled jobs

Steven Enamakel62f9cd320802
diff --git a/crates/openhuman-core/src/tools/impl/system/schedule.rs b/crates/openhuman-core/src/tools/impl/system/schedule.rs
index 5332e23232..810b99dac7 100644
--- a/crates/openhuman-core/src/tools/impl/system/schedule.rs
+++ b/crates/openhuman-core/src/tools/impl/system/schedule.rs
@@ -79,6 +79,16 @@ impl Tool for ScheduleTool {
}
async fn execute(&self, args: serde_json::Value) -> Result<ToolResult> {
+ self.execute_with_context(args, tinytools::ToolCallOptions::default(), None)
+ .await
+ }
+
+ async fn execute_with_context(
+ &self,
+ args: serde_json::Value,
+ _options: tinytools::ToolCallOptions,
+ tool_context: Option<&dyn tinytools::ToolRunContext>,
+ ) -> Result<ToolResult> {
let action = args
.get("action")
.and_then(|value| value.as_str())
@@ -97,7 +107,9 @@ impl Tool for ScheduleTool {
if let Some(blocked) = self.enforce_mutation_allowed(action) {
return Ok(blocked);
}
- self.handle_create_like(action, &args).await
+ let origin =
+ crate::agent::tinyagents::host::run_context::turn_origin_for_tool(tool_context);
+ self.handle_create_like(action, &args, origin.as_ref()).await
}
"cancel" | "remove" => {
if let Some(blocked) = self.enforce_mutation_allowed(action) {
@@ -236,6 +248,7 @@ impl ScheduleTool {
&self,
action: &str,
args: &serde_json::Value,
+ origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,
) -> Result<ToolResult> {
let command = args
.get("command")
@@ -359,7 +372,7 @@ impl ScheduleTool {
delivery: None,
delete_after_run,
},
- current_job_origin(),
+ current_job_origin(origin),
)
.map_err(anyhow::Error::msg)?;