Skip to content

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

fix(cron): sync checked-in schema catalog, tighten conformance test

Shanu245542107525
diff --git a/app/schema.json b/app/schema.json
index 7ec1cca42a..b9a7322b91 100644
--- a/app/schema.json
+++ b/app/schema.json
@@ -952,7 +952,7 @@
]
},
{
- "description": "Run a cron job immediately and record run metadata.",
+ "description": "Enqueue a cron job for immediate background execution and return once it is queued. The terminal outcome (ok/error, duration, output) is recorded in the run history — read it with `cron_runs`.",
"function": "run",
"inputs": [
{
@@ -966,35 +966,23 @@
"namespace": "cron",
"outputs": [
{
- "comment": "Immediate execution result payload.",
+ "comment": "Enqueue acknowledgement payload.",
"name": "result",
"required": true,
"ty": {
"Object": {
"fields": [
{
- "comment": "Executed cron job identifier.",
+ "comment": "Enqueued cron job identifier.",
"name": "job_id",
"required": true,
"ty": "String"
},
{
- "comment": "Execution status.",
+ "comment": "Always \"queued\" — the job runs in the background; poll `cron_runs` for the terminal status.",
"name": "status",
"required": true,
- "ty": { "Enum": { "variants": ["ok", "error"] } }
- },
- {
- "comment": "Execution duration in milliseconds.",
- "name": "duration_ms",
- "required": true,
- "ty": "I64"
- },
- {
- "comment": "Captured command output (possibly truncated).",
- "name": "output",
- "required": true,
- "ty": "String"
+ "ty": { "Enum": { "variants": ["queued"] } }
}
]
}
diff --git a/src/openhuman/cron/ops_tests.rs b/src/openhuman/cron/ops_tests.rs
index a865fb5639..d556cf783d 100644
--- a/src/openhuman/cron/ops_tests.rs
+++ b/src/openhuman/cron/ops_tests.rs
@@ -496,18 +496,35 @@ async fn cron_run_response_conforms_to_its_declared_schema() {
);
}
+ // A present field must also match its declared *type*. Skipping a
+ // non-string value here would let `{"job_id": 1, "status": 0}` pass the
+ // two loops above, which is the same class of silent divergence this test
+ // exists to catch.
for field in fields {
- let TypeSchema::Enum { variants } = &field.ty else {
- continue;
+ let Some(value) = result.get(field.name) else {
+ continue; // absence is the required-field loop's business
};
- let Some(value) = result.get(field.name).and_then(|v| v.as_str()) else {
- continue;
- };
- assert!(
- variants.contains(&value),
- "cron_run returned '{value}' for '{}', not among the declared variants {variants:?}",
- field.name
- );
+ match &field.ty {
+ TypeSchema::String => assert!(
+ value.is_string(),
+ "cron_run returned {value} for '{}', which is declared String",
+ field.name
+ ),
+ TypeSchema::Enum { variants } => {
+ let text = value.as_str().unwrap_or_else(|| {
+ panic!(
+ "cron_run returned {value} for '{}', which is declared an enum of {variants:?}",
+ field.name
+ )
+ });
+ assert!(
+ variants.contains(&text),
+ "cron_run returned '{text}' for '{}', not among the declared variants {variants:?}",
+ field.name
+ );
+ }
+ _ => {}
+ }
}
}