openclaw - ✅(Solved) Fix Bug: Cron Job delivery channel defaults to 'last' instead of valid channel [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#52706Fetched 2026-04-08 01:20:03
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
cross-referenced ×2commented ×1subscribed ×1unsubscribed ×1

Root Cause

Root Cause: The "last" value means "use the last successfully sent channel" and relies on session history. For newly created cron jobs without a session history, lastChannel resolves to undefined, causing delivery to fail.

Fix Action

Fixed

PR fix notes

PR #52769: Fix Cron delivery channel defaults for new jobs

Description (problem / solution / changelog)

Summary

  • Problem: new Cron jobs defaulted announce delivery to last, which is not a valid initial channel choice for a newly created job.
  • Why it matters: users can save jobs with an implicit delivery target that has no prior run context, instead of starting from a concrete configured channel.
  • What changed: new Cron forms now resolve blank announce-channel state to the first configured concrete channel, while preserving existing jobs that already use last.
  • What did NOT change (scope boundary): this does not remove the last option for existing jobs or change persisted Cron jobs that already explicitly use it.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #52706

User-visible / Behavior Changes

New Cron jobs no longer implicitly default announce delivery to last; the UI now prefers a concrete configured channel for new job setup.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local Node/pnpm checkout
  • Model/provider: N/A
  • Integration/channel (if any): Control UI / Cron jobs
  • Relevant config (redacted): configured channel list with at least one concrete channel

Steps

  1. Open the Cron job form for a new job.
  2. Leave result delivery in announce mode.
  3. Inspect the selected channel and submit behavior.

Expected

  • New jobs should start from a concrete configured channel instead of implicitly using last.

Actual

  • The form previously defaulted new jobs to last.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Focused validation:

  • pnpm --dir ui test src/ui/controllers/cron.test.ts src/ui/views/cron.test.ts
  • pnpm exec oxlint ui/src/ui/app-defaults.ts ui/src/ui/app-render.ts ui/src/ui/controllers/cron.ts ui/src/ui/views/cron.ts ui/src/ui/controllers/cron.test.ts ui/src/ui/views/cron.test.ts

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: new announce jobs pick the first configured channel; existing last channel values are preserved; the last option remains available
  • Edge cases checked: no forced rewrite of explicit last; failure-alert channel resolution follows the same rule when custom announce alerts are enabled
  • What you did not verify: full browser-level manual repro against a running Control UI session

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert this PR
  • Files/config to restore: ui/src/ui/app-defaults.ts, ui/src/ui/controllers/cron.ts, ui/src/ui/app-render.ts, ui/src/ui/views/cron.ts
  • Known bad symptoms reviewers should watch for: new Cron jobs selecting last again by default, or existing jobs losing explicit last channel selections

Risks and Mitigations

  • Risk: changing default channel selection could accidentally rewrite existing persisted last behavior
    • Mitigation: the fix only resolves blank new-form state and preserves explicit last values already present on existing jobs

Changed files

  • ui/src/ui/app-defaults.ts (modified, +2/-2)
  • ui/src/ui/app-render.ts (modified, +20/-5)
  • ui/src/ui/controllers/cron.test.ts (modified, +33/-0)
  • ui/src/ui/controllers/cron.ts (modified, +32/-2)
  • ui/src/ui/views/cron.test.ts (modified, +35/-0)
  • ui/src/ui/views/cron.ts (modified, +27/-6)

Code Example

"Delivering to Feishu requires target <chatId|user:openId|chat:chatId>"
RAW_BUFFERClick to expand / collapse

Bug: Cron Job delivery channel defaults to "last" instead of valid channel

Description: When creating a new Cron Job via OpenClaw control UI, the delivery.channel field defaults to "last" which causes delivery failure for new jobs that have no previous session history.

Steps to reproduce:

  1. Open OpenClaw dashboard → Cron Jobs
  2. Click "New Job"
  3. Fill in job details (name, schedule, payload)
  4. Check the delivery configuration (usually kept as default)
  5. Save and check ~/.openclaw/cron/jobs.json
  6. See "channel": "last" instead of a valid channel ID

Expected: New jobs should default to a valid channel ID or show a warning that no channel is selected.

Actual: Channel defaults to "last" which fails with:

"Delivering to Feishu requires target <chatId|user:openId|chat:chatId>"

Root Cause: The "last" value means "use the last successfully sent channel" and relies on session history. For newly created cron jobs without a session history, lastChannel resolves to undefined, causing delivery to fail.

Code locations:

  • ui/src/ui/app-defaults.ts - defaults deliveryChannel: "last" and failureAlertChannel: "last"
  • ui/src/ui/views/cron.ts:957 - form .value=${props.form.deliveryChannel || "last"}
  • src/infra/outbound/targets.ts:135 - "last" resolution: let channel = requestedChannel === "last" ? lastChannel : requestedChannel;

Version:

  • OpenClaw: v2026.3.13-1
  • Node: v24.13.1
  • macOS: Darwin 24.3.0

Suggested Fix Options:

  1. Option 1: Change the default to an empty string and show a validation warning if no channel is selected
  2. Option 2: Auto-populate with the most recently used channel from existing jobs
  3. Option 3: Add a dropdown that only shows valid channel IDs (excluding "last") for new jobs

Additional context: This affects all newly created cron jobs from the UI, making them fail to deliver results without manual intervention to fix the channel value.

extent analysis

Fix Plan

To fix the issue, we will implement Option 1: Change the default to an empty string and show a validation warning if no channel is selected.

Step-by-Step Solution:

  1. Update defaults: In ui/src/ui/app-defaults.ts, change the default deliveryChannel value to an empty string:

deliveryChannel: "",

2. **Modify form value**: In `ui/src/ui/views/cron.ts:957`, update the form value to use the new default:
   ```typescript
.value=${props.form.deliveryChannel || ""}
  1. Add validation warning: In ui/src/ui/views/cron.ts, add a validation check to display a warning if no channel is selected:

if (!props.form.deliveryChannel) { console.warn("No delivery channel selected. Please choose a valid channel."); // Display warning to user }

4. **Update channel resolution**: In `src/infra/outbound/targets.ts:135`, keep the existing logic to resolve the `"last"` channel value, but add a check to handle the new default empty string value:
   ```typescript
let channel = requestedChannel === "last" ? lastChannel : requestedChannel;
if (!channel) {
  throw new Error("No valid delivery channel selected.");
}

Verification

To verify the fix, create a new cron job and check that:

  • The deliveryChannel field is empty by default.
  • A validation warning is displayed if no channel is selected.
  • The job fails with a clear error message if no valid channel is selected.

Extra Tips

  • Consider implementing Option 2 or Option 3 for a more user-friendly experience.
  • Review existing cron jobs to ensure they have a valid deliveryChannel value.
  • Test the fix thoroughly to ensure it works as expected in different scenarios.

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