Skip to content

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

chore: files changed crates/openhuman-core/src/cron/policy.rs

Steven Enamakeld47f0afbbca8
diff --git a/crates/openhuman-core/src/cron/policy.rs b/crates/openhuman-core/src/cron/policy.rs
new file mode 100644
index 0000000000..5fe2a5f48c
--- /dev/null
+++ b/crates/openhuman-core/src/cron/policy.rs
@@ -0,0 +1,42 @@
+//! Per-job run policy: retry budget and single-flight.
+//!
+//! Stub (RED).
+
+use std::path::PathBuf;
+
+use anyhow::Result;
+use serde::{Deserialize, Serialize};
+
+use crate::config::Config;
+
+/// How the scheduler runs one job.
+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
+pub struct JobPolicy {
+ /// Retries after a failed attempt. `None` keeps the default.
+ pub retries: Option<u32>,
+ /// Skip a run that comes due while the previous one is still running.
+ pub single_flight: bool,
+}
+
+pub(crate) fn db_path(config: &Config) -> PathBuf {
+ config.workspace_dir.join("cron").join("jobs.db")
+}
+
+/// The policy stored for `job_id`.
+pub fn get_policy(_config: &Config, _job_id: &str) -> Result<JobPolicy> {
+ Ok(JobPolicy::default())
+}
+
+/// Store `policy` for `job_id`.
+pub fn set_policy(_config: &Config, _job_id: &str, _policy: JobPolicy) -> Result<()> {
+ Ok(())
+}
+
+/// Retry budget for a job with `policy`.
+pub fn effective_retries(_config: &Config, _policy: &JobPolicy) -> u32 {
+ 0
+}
+
+#[cfg(test)]
+#[path = "policy_tests.rs"]
+mod tests;