Skip to content

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

feat(cron): add channel_session to job origin handling

Steven Enamakel3b1f5b58b85f
diff --git a/crates/openhuman-core/src/cron/job_builder_tests.rs b/crates/openhuman-core/src/cron/job_builder_tests.rs
index e825008197..4e460fe17f 100644
--- a/crates/openhuman-core/src/cron/job_builder_tests.rs
+++ b/crates/openhuman-core/src/cron/job_builder_tests.rs
@@ -39,6 +39,7 @@ fn channel() -> JobOrigin {
history_key: "telegram_alice_42".into(),
sender: Some("alice".into()),
thread_id: None,
+ channel_session: None,
}
}
diff --git a/crates/openhuman-core/src/cron/origin.rs b/crates/openhuman-core/src/cron/origin.rs
index ef8710375b..c0a4ccba34 100644
--- a/crates/openhuman-core/src/cron/origin.rs
+++ b/crates/openhuman-core/src/cron/origin.rs
@@ -33,6 +33,7 @@ pub(crate) fn job_origin_from_turn(origin: &AgentTurnOrigin) -> Option<JobOrigin
sender,
reply_target,
history_key: Some(history_key),
+ channel_session: Some(channel_session),
..
} if !channel.trim().is_empty() && !reply_target.trim().is_empty() => {
Some(JobOrigin::Channel {
@@ -41,6 +42,7 @@ pub(crate) fn job_origin_from_turn(origin: &AgentTurnOrigin) -> Option<JobOrigin
history_key: history_key.clone(),
sender: sender.clone(),
thread_id: None,
+ channel_session: Some(Box::new(channel_session.clone())),
})
}
_ => None,
@@ -73,6 +75,7 @@ pub(crate) fn turn_origin_for_job_run(job: &CronJob, run_id: &str) -> AgentTurnO
reply_target,
history_key,
sender,
+ channel_session,
..
}) => AgentTurnOrigin::ExternalChannel {
sender_name: None,
@@ -81,6 +84,7 @@ pub(crate) fn turn_origin_for_job_run(job: &CronJob, run_id: &str) -> AgentTurnO
reply_target: reply_target.clone(),
message_id: format!("cron:{}:{run_id}", job.id),
history_key: Some(history_key.clone()),
+ channel_session: channel_session.as_deref().cloned(),
},
_ => AgentTurnOrigin::TrustedAutomation {
job_id: job.id.clone(),
diff --git a/crates/openhuman-core/src/cron/origin_tests.rs b/crates/openhuman-core/src/cron/origin_tests.rs
index 0dcd8ecae1..969fc5fd49 100644
--- a/crates/openhuman-core/src/cron/origin_tests.rs
+++ b/crates/openhuman-core/src/cron/origin_tests.rs
@@ -11,6 +11,7 @@ fn channel_turn(history_key: Option<&str>) -> AgentTurnOrigin {
reply_target: "42".into(),
message_id: "m1".into(),
history_key: history_key.map(str::to_string),
+ channel_session: None,
}
}
@@ -44,6 +45,7 @@ fn channel_turn_maps_to_channel_origin_with_history_key() {
history_key: "telegram_alice_42".into(),
sender: Some("alice".into()),
thread_id: None,
+ channel_session: None,
})
);
}
@@ -116,6 +118,7 @@ fn channel_origin_job_runs_as_external_channel_turn() {
history_key: "k".into(),
sender: Some("alice".into()),
thread_id: None,
+ channel_session: None,
}));
match turn_origin_for_job_run(&job, "run-1") {
AgentTurnOrigin::ExternalChannel {