openclaw - 💡(How to fix) Fix [Feature] activeUntil / expiresAt for recurring cron jobs [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#71711Fetched 2026-04-26 05:09:32
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1

Add a per-job activeUntil (or expiresAt) field for recurring cron schedules (--every, --cron). When the configured timestamp passes, the scheduler stops triggering the job and (configurably) removes it from ~/.openclaw/cron/jobs.json.

Root Cause

Add a per-job activeUntil (or expiresAt) field for recurring cron schedules (--every, --cron). When the configured timestamp passes, the scheduler stops triggering the job and (configurably) removes it from ~/.openclaw/cron/jobs.json.

Code Example

{
  "name": "priority-dash-refresh",
  "schedule": { "kind": "every", "interval": "10m" },
  "activeUntil": "2026-05-01T00:00:00Z",   // optional ISO-8601 timestamp
  "onExpire": "remove",                     // "remove" (default) | "disable"
  // ...rest of job definition unchanged
}

---

openclaw cron add --name priority-dash-refresh --every 10m \
    --message "..." --active-until 2026-05-01
RAW_BUFFERClick to expand / collapse

Summary

Add a per-job activeUntil (or expiresAt) field for recurring cron schedules (--every, --cron). When the configured timestamp passes, the scheduler stops triggering the job and (configurably) removes it from ~/.openclaw/cron/jobs.json.

Motivation

OpenClaw cron one-shots (--at) auto-delete after success. Recurring jobs have no expiration knob — they run forever unless an operator manually openclaw cron removes them.

Real use cases that hit this gap:

  • "Run this dashboard refresh every 10m until 2026-05-01" — temporary operational duty during a launch window.
  • "Generate a weekly digest every Monday 09:00 for the duration of the EU summer pilot, ending 2026-09-30."
  • "Poll this incident channel every 5m for the next 24h" — incident-bound recurring task.

Today the only options are:

  1. Add the job and rely on the operator to remember to remove it. Ops debt accumulates; orphaned jobs run forever.
  2. Build a wrapper script that writes a kill date elsewhere and calls openclaw cron remove itself. Custom-per-deployment.

A native activeUntil collapses this into the scheduler.

Proposed schema

Adding a field to recurring cron jobs:

{
  "name": "priority-dash-refresh",
  "schedule": { "kind": "every", "interval": "10m" },
  "activeUntil": "2026-05-01T00:00:00Z",   // optional ISO-8601 timestamp
  "onExpire": "remove",                     // "remove" (default) | "disable"
  // ...rest of job definition unchanged
}

CLI:

openclaw cron add --name priority-dash-refresh --every 10m \
    --message "..." --active-until 2026-05-01

openclaw cron list would show a column with the remaining lifetime / expiration date.

Behavior

  • Before each scheduled run, the scheduler checks activeUntil against now(). If expired, it skips the run and applies onExpire:
    • remove (default): delete the job from jobs.json. Mirrors the auto-cleanup behavior of --at one-shots.
    • disable: mark the job enabled: false but keep the definition for audit / re-enable.
  • A timezone-naive activeUntil would be interpreted in the gateway's local TZ, matching croner's existing behavior.
  • Non-recurring (--at) jobs reject activeUntil (their schedule already encodes a single execution).
  • The audit ledger logs cron-expired at the moment of removal/disable.

Backwards compatibility

activeUntil is optional; existing job definitions need no migration. Default behavior matches today's semantics (run forever).

Why this is worth doing in core

Every operator who runs OpenClaw with non-trivial recurring tasks rebuilds this. Reference example, just from the past week: a multi-agent fleet operator added "refresh dashboard until launch date" and had to either accept the orphan-job risk or write external lifecycle plumbing. Native activeUntil removes that burden and matches the lifecycle ergonomics already present for --at one-shots.

Happy to draft a PR if the maintainers are open to it.

extent analysis

TL;DR

Add an optional activeUntil field to recurring cron job definitions to allow for automatic expiration and removal or disabling of jobs after a specified timestamp.

Guidance

  • To implement this feature, modify the job definition schema to include the activeUntil field with an optional ISO-8601 timestamp.
  • Update the scheduler to check the activeUntil field before each scheduled run and apply the specified onExpire action (remove or disable) if the job has expired.
  • Consider adding a column to the openclaw cron list output to display the remaining lifetime or expiration date of each job.
  • Ensure backwards compatibility by making the activeUntil field optional and defaulting to the current behavior of running forever if not specified.

Example

{
  "name": "priority-dash-refresh",
  "schedule": { "kind": "every", "interval": "10m" },
  "activeUntil": "2026-05-01T00:00:00Z",
  "onExpire": "remove"
}

Notes

This feature requires careful consideration of timezone handling, as the activeUntil timestamp should be interpreted in the gateway's local timezone.

Recommendation

Apply the proposed schema change and update the scheduler to support the activeUntil field, as it provides a useful feature for managing recurring jobs and matches the existing lifecycle ergonomics for one-shot jobs.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Feature] activeUntil / expiresAt for recurring cron jobs [1 participants]