Replies: 1 comment
-
|
@hellocodelinux-alt Thanks for writing this up. I promoted it to #8409 so it can be tracked as an implementation issue. I scoped the issue as an opt-in per-shell-job output format, with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Cron shell jobs always wrap command output in a structured format:
There is no way to get raw, unmodified output from a cron shell command.
This forces consumers (agent, delivery, history) to parse an ad-hoc format
to extract the actual command output.
Proposed Solution
Add an optional output_format field to shell-type cron jobs with two values:
or appended only on non-zero exit
Implementation Plan
Config schema — new field (source of truth)
File: crates/zeroclaw-config/src/schema.rs ~line 11296
Struct: CronJobDecl
Add:
/// Output format for shell jobs.
/// "wrapped" (default) includes status/stdout/stderr labels.
/// "raw" returns only the command's stdout.
#[serde(default)]
pub output_format: String, // "wrapped" or "raw"
Default handled in schema defaults (line ~11418 area).
Runtime type — resolve from config at use-time
File: crates/zeroclaw-runtime/src/cron/types.rs ~line 142
Struct: CronJob
Per the Single Source of Truth rule, do NOT add a cached field here.
Instead, resolve from the config on demand (e.g. via a helper method
or by threading &Config through the call site).
Execution logic — use the flag
File: crates/zeroclaw-runtime/src/cron/scheduler.rs ~line 1168
Function: run_job_command_with_timeout
Change the output assembly from:
let combined = format!(
"status={}\nstdout:\n{}\nstderr:\n{}",
output.status, stdout.trim(), stderr.trim()
);
To something like:
let combined = if use_raw_output {
if output.status.success() {
stdout.trim().to_string()
} else {
format!("exit code: {}\n{}", output.status, stderr.trim())
}
} else {
format!(
"status={}\nstdout:\n{}\nstderr:\n{}",
output.status, stdout.trim(), stderr.trim()
)
};
Storage is unchanged — both formats are valid strings in last_output.
Suggestion — Web UI Integration
This option MUST be togglable from the web control panel when creating or
editing a shell-type cron task. A simple toggle or dropdown (labeled e.g.
"Output format: Wrapped / Raw") next to the shell command input field gives
users direct control without needing config-file edits.
This is especially important because:
config files to control output formatting.
(human reading vs programmatic parsing), which is a per-job concern.
avoids surprise when output suddenly includes metadata labels.
Beta Was this translation helpful? Give feedback.
All reactions