openclaw - ✅(Solved) Fix [Bug]: isolated cron-agent runs cannot reliably use the OpenClaw cron tool, while main session can [1 pull requests, 1 comments, 2 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#65981Fetched 2026-04-14 05:39:29
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Timeline (top)
closed ×1commented ×1cross-referenced ×1

OpenClaw cron tool works in the main session, but appears unavailable or mis-routed when a cron job itself runs as an isolated cron agent and tries to inspect cron state.

This breaks self-health-check jobs that are supposed to use the platform cron tool to inspect other cron jobs.

Error Message

  • flag consecutiveErrors > 0, lastRunStatus = error, or lastErrorReason = timeout

Strong evidence this is not just prompt/model error

  1. fail explicitly at tool availability/planning time with a clear capability error

Root Cause

This prevents a very natural self-monitoring pattern:

  • cron job A checks cron jobs B/C/D using the platform cron tool

Right now, that pattern appears broken specifically in isolated cron-agent execution.

Fix Action

Fix / Workaround

Current workaround

This works, but it is a workaround, not a fix.

PR fix notes

PR #66083: fix(cron): stop unresolved next-run refire loops

Description (problem / solution / changelog)

Summary

  • fix the cron scheduler path where computeJobNextRunAtMs returning undefined was treated as a short retry instead of an unresolved schedule
  • keep the #17821 lower-bound guard for same-second refires, but stop inventing synthetic retries for unschedulable cron runs
  • keep a periodic maintenance wake armed for enabled jobs with no nextRunAtMs so the scheduler does not go fully idle after clearing an unresolved schedule
  • add focused regression coverage for both the completion path and the cron error-backoff path

Root cause

src/cron/service/timer.ts used MIN_REFIRE_GAP_MS and backoff delays for two different meanings:

  1. lower bounds when a valid next run exists
  2. fallback schedule values when cron next-run computation returned undefined

That second meaning was wrong. An unschedulable cron run could be re-armed a few seconds later and refire forever.

Scope

In scope:

  • #66019

Explicitly out of scope:

  • #66016, #65916, #65193: missing job.state startup-crash family
  • #65981: isolated cron-agent execution / cron-tool mismatch
  • #65987: task timestamp audit noise

Validation

  • pnpm test -- src/cron/service/timer.regression.test.ts src/cron/service.armtimer-tight-loop.test.ts

Notes

  • pnpm check is currently failing on unrelated latest-main TypeScript errors outside this slice (Discord, Feishu, Nextcloud Talk, WhatsApp, MCP, wizard setup, and one existing cron isolated-agent test type issue). I did not broaden this PR into those unrelated failures.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/cron/service.armtimer-tight-loop.test.ts (modified, +37/-0)
  • src/cron/service.issue-66019-unresolved-next-run.test.ts (added, +114/-0)
  • src/cron/service/timer.regression.test.ts (modified, +86/-3)
  • src/cron/service/timer.ts (modified, +47/-3)
RAW_BUFFERClick to expand / collapse

Summary

OpenClaw cron tool works in the main session, but appears unavailable or mis-routed when a cron job itself runs as an isolated cron agent and tries to inspect cron state.

This breaks self-health-check jobs that are supposed to use the platform cron tool to inspect other cron jobs.

Repro shape

We had a cron-health-check job whose purpose was:

  • list all cron jobs with the OpenClaw cron tool
  • flag consecutiveErrors > 0, lastRunStatus = error, or lastErrorReason = timeout
  • also check VPS health + sandbox process health

The exact same conceptual check behaves differently depending on execution lane:

Main session / normal chat

Using the OpenClaw cron tool from the main session works. We can successfully list jobs and inspect their state.

Isolated cron agent

When the health-check job runs as sessionTarget: "isolated", it fails to access cron state. Observed failure modes across runs included:

  • cron: not found
  • openclaw command not found
  • generic “cron 状态未成功取到” summaries

This happened even after tightening the prompt to explicitly say:

  • use the OpenClaw cron tool
  • do not inspect local files
  • do not run shell commands like cron or openclaw cron

We also tried:

  • openai-codex/gpt-5.4-mini with thinking=medium
  • openai-codex/gpt-5.4-mini with thinking=high
  • anthropic/claude-sonnet-4-6

The isolated path still failed.

Strong evidence this is not just prompt/model error

We then changed the job from:

  • sessionTarget: "isolated"
  • payload.kind: "agentTurn"

to:

  • sessionTarget: "main"
  • payload.kind: "systemEvent"

So the scheduled reminder enters the main session, and the main-session agent performs the cron check there.

After that change, the same health-check workflow worked again.

That strongly suggests:

  • the OpenClaw cron tool itself is fine
  • the main session can access/use it
  • but isolated cron-agent runs cannot reliably access it, or are silently falling back to shell-command behavior instead of real tool calls

Why this matters

This prevents a very natural self-monitoring pattern:

  • cron job A checks cron jobs B/C/D using the platform cron tool

Right now, that pattern appears broken specifically in isolated cron-agent execution.

Expected behavior

If the OpenClaw cron tool is available in normal agent contexts, isolated cron-agent runs should either:

  1. also receive the cron tool and be able to use it normally, or
  2. fail explicitly at tool availability/planning time with a clear capability error

They should not degrade into trying shell commands like cron / openclaw.

Current workaround

We changed the health-check job to run as:

  • sessionTarget: main
  • payload.kind: systemEvent

This works, but it is a workaround, not a fix.

Request

Could maintainers confirm whether this is an intentional restriction or a regression?

If intentional, it would help to document clearly that isolated cron-agent runs cannot use the platform cron tool.

If not intentional, this seems like a real bug in isolated cron-agent tool availability / tool routing.

extent analysis

TL;DR

The OpenClaw cron tool is unavailable or mis-routed when used in an isolated cron agent, causing self-health-check jobs to fail.

Guidance

  • Verify that the cron tool is properly configured and accessible in the main session, as the issue seems to be specific to isolated cron-agent runs.
  • Check the documentation for any intentional restrictions on using the cron tool in isolated cron-agent contexts.
  • Consider modifying the health-check job to run in the main session, as the current workaround suggests, until a fix or clarification is provided.
  • Test the cron tool in different execution lanes to confirm the issue is not specific to the health-check job or prompt/model error.

Example

No code snippet is provided as the issue is more related to the configuration and availability of the cron tool in different execution contexts.

Notes

The issue may be due to a limitation or bug in the isolated cron-agent implementation, and further investigation is needed to determine the root cause.

Recommendation

Apply the current workaround by running the health-check job as sessionTarget: "main" and payload.kind: "systemEvent", as it is the most reliable solution until the maintainers confirm whether this is an intentional restriction or a regression.

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…

FAQ

Expected behavior

If the OpenClaw cron tool is available in normal agent contexts, isolated cron-agent runs should either:

  1. also receive the cron tool and be able to use it normally, or
  2. fail explicitly at tool availability/planning time with a clear capability error

They should not degrade into trying shell commands like cron / openclaw.

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 - ✅(Solved) Fix [Bug]: isolated cron-agent runs cannot reliably use the OpenClaw cron tool, while main session can [1 pull requests, 1 comments, 2 participants]