openclaw - 💡(How to fix) Fix Cron payload.model override ignored — agent primary model wins via 'live session model switch' [1 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#57968Fetched 2026-04-08 01:55:30
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
2
Author
Participants
Timeline (top)
cross-referenced ×1subscribed ×1

Error Message

Gateway logs show:

Fix Action

Fix / Workaround

  • Tested with agentId: "main" and with --clear-agent — same result both ways
  • Session key is always agent:main:cron:... even without explicit agentId
  • The agents.defaults.models allowlist is not the issue (no "not allowed" warning after adding Sonnet)
  • The "not allowed" issue from earlier versions (2026.3.24) is separate and was fixed by adding Sonnet to the allowlist

Code Example

[agent/embedded] live session model switch detected before attempt for <runId>: anthropic/claude-sonnet-4-6 -> anthropic/claude-opus-4-6
[model-fallback/decision] candidate_failed, requestedModel: claude-sonnet-4-6, errorPreview: "Live session model switch requested: anthropic/claude-opus-4-6"
[model-fallback/decision] candidate_succeeded, candidateModel: claude-opus-4-6, attempt: 2
RAW_BUFFERClick to expand / collapse

Bug

Cron jobs with payload.model set to a different model than the agent's primary model always fall back to the agent's primary model. The docs state that job payload override has highest priority, but the code disagrees.

Environment

  • OpenClaw 2026.3.28 (f9b1079)
  • Agent primary model: anthropic/claude-opus-4-6
  • Cron payload.model: anthropic/claude-sonnet-4-6
  • Sonnet is in agents.defaults.models allowlist

Steps to reproduce

  1. Configure an agent with anthropic/claude-opus-4-6 as primary model
  2. Add anthropic/claude-sonnet-4-6 to agents.defaults.models allowlist
  3. Create an isolated cron job with payload.model: "anthropic/claude-sonnet-4-6"
  4. Run the cron job (openclaw cron run <id>)
  5. Check run history — model shows claude-opus-4-6, not Sonnet

Observed behavior

Gateway logs show:

[agent/embedded] live session model switch detected before attempt for <runId>: anthropic/claude-sonnet-4-6 -> anthropic/claude-opus-4-6
[model-fallback/decision] candidate_failed, requestedModel: claude-sonnet-4-6, errorPreview: "Live session model switch requested: anthropic/claude-opus-4-6"
[model-fallback/decision] candidate_succeeded, candidateModel: claude-opus-4-6, attempt: 2

The cron correctly starts with Sonnet, but then a "live session model switch" overrides it to the agent's primary model (Opus). Sonnet is treated as a failed candidate, and Opus succeeds as fallback.

Expected behavior

Per cron-jobs.md:

Resolution priority:

  1. Job payload override (highest)
  2. Hook-specific defaults
  3. Agent config default

payload.model should take precedence over the agent's primary model for isolated cron jobs.

Additional context

  • Tested with agentId: "main" and with --clear-agent — same result both ways
  • Session key is always agent:main:cron:... even without explicit agentId
  • The agents.defaults.models allowlist is not the issue (no "not allowed" warning after adding Sonnet)
  • The "not allowed" issue from earlier versions (2026.3.24) is separate and was fixed by adding Sonnet to the allowlist

extent analysis

Fix Plan

To resolve the issue where cron jobs with a payload.model set to a different model than the agent's primary model fall back to the agent's primary model, we need to modify the code to prioritize the job payload override as stated in the documentation.

  1. Update the model selection logic: Modify the model-fallback/decision module to check for a payload.model override before defaulting to the agent's primary model.
  2. Add a conditional check: Introduce a conditional statement to verify if a payload.model is specified in the cron job configuration. If it is, use that model instead of the agent's primary model.

Example code snippet:

if 'model' in job_payload:
    # Use the model specified in the job payload
    selected_model = job_payload['model']
else:
    # Fall back to the agent's primary model
    selected_model = agent_primary_model
  1. Verify the payload.model value: Ensure that the payload.model value is correctly set in the cron job configuration and is not being overwritten or ignored.

Verification

To verify that the fix worked:

  1. Update the code with the modified model selection logic.
  2. Create a new cron job with a payload.model set to a different model than the agent's primary model (e.g., anthropic/claude-sonnet-4-6).
  3. Run the cron job and check the run history to ensure that the correct model is used.

Extra Tips

  • Make sure to test the fix with different models and cron job configurations to ensure that the issue is fully resolved.
  • Review the documentation to ensure that it accurately reflects the updated behavior.
  • Consider adding additional logging or debugging statements to help diagnose any future issues related to model selection.

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

Per cron-jobs.md:

Resolution priority:

  1. Job payload override (highest)
  2. Hook-specific defaults
  3. Agent config default

payload.model should take precedence over the agent's primary model for isolated cron jobs.

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 - 💡(How to fix) Fix Cron payload.model override ignored — agent primary model wins via 'live session model switch' [1 participants]