Cron Worker Guardrails
by @phenomenoner
Use when: hardening OpenClaw cron/background workers (POSIX shells: bash/sh) against brittle quoting, cwd/env drift, and false pipeline failures (SIGPIPE, pi...
clawhub install cron-worker-guardrailsπ About This Skill
name: cron-worker-guardrails slug: cron-worker-guardrails version: 1.0.5 license: MIT description: | Use when: hardening OpenClaw cron/background workers (POSIX shells: bash/sh) against brittle quoting, cwd/env drift, and false pipeline failures (SIGPIPE, pipefail + head). Don't use when: the issue is application logic rather than execution-wrapper reliability. Output: a scripts-first hardening checklist + safe patterns (silent-on-success, deterministic cwd/env, rollback-friendly). metadata: openclaw: emoji: "π§―"
Cron Worker Guardrails (POSIX)
A reliability-first checklist for OpenClaw cron workers and any unattended automation.
Scope (important)
The NO_REPLY convention
Many OpenClaw setups treat emitting exactly NO_REPLY as "silent success" (no human notification).
NO_REPLY, interpret it as: print nothing on success.Quick Start
1) Scripts-first: move logic into a repo script (recommended: tools/ or tools/).
2) One command in cron: cron should run *one short command* (no multi-line bash -lc '...').
3) Deterministic cwd/env: cd to the repo (or have the script do it), and document required env vars.
4) Silent on success: print nothing (or exactly NO_REPLY) when OK; only emit a short alert when broken.
Also see:
references/cron-agent-contract.mdreferences/pitfalls.mdWhy this skill exists
Cron failures are rarely "logic bugs". In practice they're often:
bash -lc '...' nested quotes)$(...))python -c "...")pipefail + head / SIGPIPE)The fix is boring but effective: scripts-first + deterministic execution + silent-on-success.
Portability rules (still apply)
Even on POSIX, do not hardcode deployment-specific absolute paths tied to one machine.
Prefer:
cd into the repoCommon failure patterns -> fixes
1) unexpected EOF while looking for matching ')'
Likely causes:
$(...) from command substitutionbash -lc ' ... 'Fix pattern:
python3 tools/.py 2) False failure from pipefail + head (SIGPIPE)
Symptom:
Fix pattern:
pipefail when piping into head3) "Works locally, fails in cron"
Common causes:
Fix pattern:
cd into the repo (or have the script do it)Git footgun: git push rejected (non-fast-forward)
Symptom:
! [rejected] ... (non-fast-forward) when automation pushes to a long-lived PR/feature branch.Conservative fix (no force-push):
Copy/paste hardening header (portable)
Use this near the top of a cron prompt (2 lines, low-noise):
references/cron-agent-contract.md (scripts-first, deterministic cwd, silent-on-success).cron-worker-guardrails skill. If parsing/multi-step logic is needed, write/run a small tools/*.py script.π‘ Examples
1) Scripts-first: move logic into a repo script (recommended: tools/ or tools/).
2) One command in cron: cron should run *one short command* (no multi-line bash -lc '...').
3) Deterministic cwd/env: cd to the repo (or have the script do it), and document required env vars.
4) Silent on success: print nothing (or exactly NO_REPLY) when OK; only emit a short alert when broken.
Also see:
references/cron-agent-contract.mdreferences/pitfalls.md