Skip to content

Bug: Cron job state inconsistency - lastDelivered: true but lastRunStatus: error #49258

Description

@nariloy-bit

Bug type

Regression (worked before, now fails)

Summary

Cron job shows contradictory state: lastDelivered=true (message sent successfully) but lastRunStatus=error (marked as failed), causing false positive error alerts and accumulated consecutiveErrors despite successful delivery.

Steps to reproduce

  1. Create a Cron job with delivery.mode: "announce" to Feishu channel
  2. Let the job execute (or manually trigger with openclaw cron run --id <id>)
  3. Observe the job successfully sends message to Feishu group
  4. Run openclaw cron list --include-disabled
  5. Check job state: lastDelivered=true but lastRunStatus=error

Expected behavior

When lastDelivered=true (message successfully delivered), the lastRunStatus should be "ok" and consecutiveErrors should be reset to 0. The state fields should be consistent: successful delivery = successful execution.

Actual behavior

Job state shows contradictory values:

  • state.lastDelivered: true (message was sent successfully to Feishu)
  • state.lastRunStatus: "error" (but marked as failed)
  • state.consecutiveErrors: keeps incrementing (4+ errors despite successful delivery)

Additional issue: Found hardcoded platform-specific error messages in code:

throw new Error("telegram sendMessage failed: ...");

This should be parameterized since the actual platform is Feishu, not Telegram.

OpenClaw version

2026.3.2

Operating system

Windows 11 (Windows_NT 10.0.26200)

Install method

npm global

Model

bailian/qwen3.5-plus

Provider / routing chain

openclaw -> bailian (DashScope) -> qwen3.5-plus

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: All users using Cron jobs for monitoring and scheduled tasks
Severity: Medium-High (causes false positive alerts, confusing monitoring dashboards)
Frequency: 100% reproducible when Cron job successfully delivers messages
Consequence:

  • Monitoring reports show errors when jobs actually succeeded
  • consecutiveErrors accumulates incorrectly, may trigger false alerts
  • Users cannot trust the job state for health monitoring
  • Hardcoded error messages cause confusion during debugging

Additional information

Root Cause Analysis:

The state update logic in Cron job execution doesn't properly correlate delivery success with execution status. When a job successfully delivers its output, the lastRunStatus should reflect that success.

Suggested Fix:

In the Cron job state update logic:

if (job.state.lastDelivered === true) {
    job.state.lastRunStatus = "ok";
    job.state.consecutiveErrors = 0;  // Reset error count
}

Files Involved:

  • packages/plugin-sdk/src/cron/types.ts - Type definitions
  • dist/plugin-sdk/cron/types.d.ts - Shows the state fields are meant to be independent
  • dist/pi-embedded-*.js - Execution logic (compiled)

Additional Bug: Hardcoded Error Messages

Found in dist/pi-embedded-CtM2Mrrj.js:76882:

throw new Error("telegram sendMessage failed: ...");

This should be parameterized to support multiple platforms (Feishu, Discord, Telegram, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions