Skip to content

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

fix(cron): allow trusted memory jobs in hosted-profile sweeps

Steven Enamakelc5399bb76ffb
diff --git a/crates/openhuman-core/src/cron/bus_host.rs b/crates/openhuman-core/src/cron/bus_host.rs
index ef1e972c51..9ae7538b9c 100644
--- a/crates/openhuman-core/src/cron/bus_host.rs
+++ b/crates/openhuman-core/src/cron/bus_host.rs
@@ -52,8 +52,8 @@ pub(crate) struct Binding {
config: Arc<RwLock<Config>>,
pub(crate) security: Arc<SecurityPolicy>,
context: Option<Weak<CoreContext>>,
- /// Only agent jobs run (the hosted-profile sweep): shell and flow rows are
- /// refused whatever the config says.
+ /// The hosted-profile sweep runs agent jobs plus trusted memory system
+ /// jobs; shell and user-owned flow rows are refused.
agent_only: bool,
runtime: Option<tokio::runtime::Handle>,
#[cfg(feature = "flows")]
@@ -280,16 +280,16 @@ pub(crate) async fn register(binding: Binding) -> Result<HostRegistration, Strin
})
}
-/// Whether a job of `job_type` may run under `binding`, and the refusal text
+/// Whether a job may run under `binding`, and the refusal text
/// if not.
pub(crate) fn kind_refusal(binding: &Binding, job: &CronJob) -> Option<String> {
- let owner_allowed =
+ let trusted_memory_job =
crate::cron::system_jobs::trusted_system_job_owner(job).is_some();
(binding.is_agent_only()
&& !matches!(job.job_type, JobType::Agent)
- && !owner_allowed)
+ && !trusted_memory_job)
.then(|| {
- "blocked by hosting policy: only agent cron jobs run here; shell and flow jobs are disabled"
+ "blocked by hosting policy: only agent cron jobs and trusted memory maintenance run here; shell and user flow jobs are disabled"
.to_string()
})
}
diff --git a/crates/openhuman-core/src/cron/limits.rs b/crates/openhuman-core/src/cron/limits.rs
index c4d93ffda8..c209907d85 100644
--- a/crates/openhuman-core/src/cron/limits.rs
+++ b/crates/openhuman-core/src/cron/limits.rs
@@ -1,8 +1,9 @@
//! Operator-owned limits for hosted deployments (`[cron] agent_jobs_only`).
//!
-//! With the mode on, a profile may only hold agent jobs bound to the
-//! conversation that created them: shell and flow jobs are refused whatever the
-//! autonomy level, delivery is limited to `origin` and `none` (no model- or
+//! With the mode on, a profile may hold agent jobs bound to the conversation
+//! that created them and the memory domain's two trusted maintenance jobs.
+//! User-owned shell and flow jobs are refused whatever the autonomy level;
+//! delivery is limited to `origin` and `none` (no model- or
//! user-chosen destination), recurring jobs keep `min_interval_secs` apart and
//! at most `max_active_jobs` jobs are enabled at once, counted in the job
//! store rather than in this process. Each check runs where a job is added or
@@ -25,7 +26,7 @@ fn check_type(job_type: &JobType) -> Result<()> {
if matches!(job_type, JobType::Agent) {
return Ok(());
}
- bail!("only agent cron jobs are allowed here; shell and flow jobs are disabled")
+ bail!("only agent cron jobs are allowed here; shell and user flow jobs are disabled")
}
fn check_schedule(config: &Config, schedule: &Schedule) -> Result<()> {
diff --git a/crates/openhuman-core/src/cron/scheduler/executor.rs b/crates/openhuman-core/src/cron/scheduler/executor.rs
index a2edfc2a37..7036249ce4 100644
--- a/crates/openhuman-core/src/cron/scheduler/executor.rs
+++ b/crates/openhuman-core/src/cron/scheduler/executor.rs
@@ -100,7 +100,7 @@ impl HostExecutor {
warn_if_high_frequency_agent_job(&config, job).await;
self.binding.publish_triggered_once(job, run_id);
}
- // A hosted-profile sweep runs agent jobs only.
+ // A hosted-profile sweep runs agent jobs and trusted memory jobs.
if let Some(refusal) = kind_refusal(&self.binding, job) {
self.halt(run_id, Halt::Refused);
return Attempt {