Skip to content

fix: cron text payload silently ignores model override#2245

Open
BingqingLyu wants to merge 2 commits into
mainfrom
fork-pr-64060-fix-cron-text-payload-model-ignored
Open

fix: cron text payload silently ignores model override#2245
BingqingLyu wants to merge 2 commits into
mainfrom
fork-pr-64060-fix-cron-text-payload-model-ignored

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 28, 2026

Copy link
Copy Markdown
Owner

Bug

openclaw cron edit --model has no effect when the cron payload uses the text field instead of message.

When kind is not explicitly set, coercePayload() infers systemEvent from the presence of text, then strips all agentTurn-only fields including model. The model override is silently discarded.

This was reported in openclaw#28905 (closed as stale) — this PR provides the root-cause fix.

Fix

In coercePayload(), when text is present alongside agentTurn-only fields (detected by the existing hasAgentTurnPayloadHint()), infer agentTurn and promote textmessage instead of inferring systemEvent.

Before

payload: { text: "Run sync", model: "anthropic/claude-sonnet-4-6" }
→ kind: "systemEvent" → model deleted → runs on system default (haiku)

After

payload: { text: "Run sync", model: "anthropic/claude-sonnet-4-6" }
→ kind: "agentTurn", message: "Run sync", model preserved → runs on sonnet

Test plan

  • Added test for normalizeCronJobCreate with text + model → verifies promotion to agentTurn
  • Added test for normalizeCronJobPatch with text + model → verifies promotion to agentTurn
  • Existing test for explicit kind: "systemEvent" + model → still prunes model (no behavior change)
  • All 53 cron normalize tests pass
  • pnpm check passes

Closes openclaw#28905

…lds are present

When a cron payload uses the text field alongside agentTurn-only fields
(model, fallbacks, thinking, etc.), coercePayload now infers agentTurn
instead of systemEvent, converting text to message.

Previously the model override was silently deleted because systemEvent
payloads strip all agentTurn-only fields. This caused openclaw cron edit
--model to have no effect on text-based payloads.

Closes openclaw#28905
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 model field overridden by agent default model

2 participants