Skip to content

Warn on high-frequency cron schedules (<30m)#59

Open
BingqingLyu wants to merge 1 commit into
mainfrom
fork-pr-38731-fix-cron-add-highfreq-warning
Open

Warn on high-frequency cron schedules (<30m)#59
BingqingLyu wants to merge 1 commit into
mainfrom
fork-pr-38731-fix-cron-add-highfreq-warning

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Draft PR Description

Title: Warn on high-frequency cron schedules (<30m) to reduce session accumulation risk

Summary

High-frequency cron jobs (e.g. every 15m/30m) can silently accumulate sessions and inflate the agent context window until the agent becomes non-responsive (“dispatch succeeds but replies=0”). This PR adds a minimal guardrail: warn when creating cron jobs with --every intervals under 30 minutes.

What this PR does

  • CLI warning during openclaw cron add if --every < 30m.
  • Gateway log warning on cron.add for schedule.kind="every" and everyMs < 30m.

CLI message:

Warning: High-frequency cron (< 30m) may cause session accumulation and silently exhaust the agent context window. Consider using heartbeat or longer intervals.

Why this is safe

  • Does not block cron creation (no breaking change).
  • Provides immediate, actionable feedback at the moment of job creation.

Implementation

  • src/cli/cron-cli/register.cron-add.ts
  • src/gateway/server-methods/cron.ts

Tests

  • pnpm vitest src/cli/cron-cli.test.ts --run
  • pnpm vitest src/gateway/server.cron.test.ts --run

Closes openclaw#38730

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron session accumulation can silently exhaust agent context window — no guardrails or warnings

1 participant