openclaw - ✅(Solved) Fix [Bug]: Cron payload model override ignored — always resolves to agent default [1 pull requests, 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#57947Fetched 2026-04-08 01:55:52
View on GitHub
Comments
0
Participants
1
Timeline
16
Reactions
1
Author
Participants
Timeline (top)
referenced ×12cross-referenced ×2labeled ×2

Cron jobs with payload.model set to a specific model (e.g., openai-codex/gpt-5.3-codex) always resolve to the agents.defaults.model.primary model instead. The payload model override is completely ignored.

Per the docs (automation/cron-jobs.md), the resolution priority should be:

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

In practice, step 1 is skipped and all isolated cron jobs run on the agent default.

Root Cause

Cron jobs with payload.model set to a specific model (e.g., openai-codex/gpt-5.3-codex) always resolve to the agents.defaults.model.primary model instead. The payload model override is completely ignored.

Per the docs (automation/cron-jobs.md), the resolution priority should be:

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

In practice, step 1 is skipped and all isolated cron jobs run on the agent default.

Fix Action

Fixed

PR fix notes

PR #4: fix(cron): propagate error when payload.model is not in allowlist (#57947)

Description (problem / solution / changelog)

Summary

Fixes #57947 — cron payload.model override silently ignored when the model is not in the configured allowlist.

Root cause: resolveCronModelSelection caught the "model not allowed:" error returned by resolveAllowedModelRef and silently fell back to the agent default model, logging only a server-side warning. From the user's perspective, payload.model appeared to be completely ignored.

Fix: Remove the special-case silent fallback for "model not allowed:" errors so the cron job fails with a clear, visible error. Users can then diagnose the problem (add the model to agents.defaults.models, or use an allowed model in the payload).

Additional fixes:

  • Corrected a mock typo in run.cron-model-override.test.ts: the mock used "Model not allowed:" (capital M), which accidentally bypassed the startsWith("model not allowed:") guard and made the test pass for the wrong reason — it was testing the "any other error → propagate" path rather than the "disallowed model" path.
  • Updated run.skill-filter.test.ts "falls back to agent defaults when payload.model is not allowed" to reflect the corrected behavior: disallowed models now return an error instead of a silent fallback.

Test plan

  • pnpm test -- src/cron/isolated-agent/run.cron-model-override.test.ts — all 6 tests pass
  • pnpm test -- src/cron/isolated-agent/run.skill-filter.test.ts — all 13 tests pass
  • pnpm test -- src/cron/ — all 277 cron tests pass
  • pnpm check — lint and type checks clean

AI-assisted

This PR was built with Claude Code. The code changes are small and targeted. I have reviewed and understand what the code does.

  • AI-assisted
  • Lightly tested (scoped cron test suite)
  • I understand what the code does

https://claude.ai/code/session_01VCiFPtUWbTCNUAqN5ti6EQ

Changed files

  • FixRecord.md (modified, +31/-0)
  • fixrecord/57947_20260330.md (added, +43/-0)
  • src/cron/isolated-agent/model-selection.ts (modified, +0/-8)
  • src/cron/isolated-agent/run.cron-model-override.test.ts (modified, +2/-2)
  • src/cron/isolated-agent/run.skill-filter.test.ts (modified, +14/-16)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Cron jobs with payload.model set to a specific model (e.g., openai-codex/gpt-5.3-codex) always resolve to the agents.defaults.model.primary model instead. The payload model override is completely ignored.

Per the docs (automation/cron-jobs.md), the resolution priority should be:

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

In practice, step 1 is skipped and all isolated cron jobs run on the agent default.

Steps to reproduce

  1. Set agents.defaults.model.primary to anthropic/claude-opus-4-6
  2. Create an isolated cron job with payload.model: "openai-codex/gpt-5.3-codex"
  3. Run the job (manual or scheduled)
  4. Check cron runs — the model field in the run log shows claude-opus-4-6, not gpt-5.3-codex

Expected behavior

Cron jobs with payload.model set (e.g., openai-codex/gpt-5.3-codex) should use that model for the run, overriding agents.defaults.model.primary, as documented in automation/cron-jobs.md under "Resolution priority."

Actual behavior

The payload.model field is ignored. All isolated cron runs resolve to agents.defaults.model.primary (anthropic/claude-opus-4-6) regardless of what model is specified in the cron payload. Confirmed across 945+ runs, persists after gateway restart, secrets reload, and OAuth re-authentication.

OpenClaw version

2026.3.28

Operating system

Ubuntu 24.04.4 LTS

Install method

No response

Model

anthropic/claude-opus-4-6 (agent default primary)

Provider / routing chain

anthropic/claude-opus-4-6 (primary), openai-codex/gpt-5.4 (fallback #1), openai-codex/gpt-5.3-codex (fallback #2)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

// agents.defaults.model in openclaw.json { "primary": "anthropic/claude-opus-4-6", "fallbacks": ["openai-codex/gpt-5.4", "openai-codex/gpt-5.3-codex"] }

// Cron payload (heartbeat example) { "kind": "agentTurn", "model": "openai-codex/gpt-5.3-codex", "message": "...", "timeoutSeconds": 120 }

extent analysis

Fix Plan

To resolve the issue where the payload.model override is ignored in cron jobs, we need to update the cron job resolution logic.

  • Update the cronJobResolver function to prioritize the payload.model override:
function cronJobResolver(cronJobPayload, agentDefaults) {
  // Check if payload.model is set
  if (cronJobPayload.model) {
    return cronJobPayload.model;
  }
  // Fallback to hook-specific defaults (if any)
  // ...
  // Fallback to agent config default
  return agentDefaults.model.primary;
}
  • Ensure that the cronJobResolver function is called for each cron job run, passing the cronJobPayload and agentDefaults as arguments.

Verification

To verify that the fix worked, create a new cron job with a payload.model override and check the run log to ensure that the specified model is used.

Extra Tips

  • Review the automation/cron-jobs.md documentation to ensure that the resolution priority is correctly described.
  • Test the fix with different payload.model overrides to ensure that the cron job resolution logic is working as expected.

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

Cron jobs with payload.model set (e.g., openai-codex/gpt-5.3-codex) should use that model for the run, overriding agents.defaults.model.primary, as documented in automation/cron-jobs.md under "Resolution priority."

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 - ✅(Solved) Fix [Bug]: Cron payload model override ignored — always resolves to agent default [1 pull requests, 1 participants]