Skip to content

fix(cron): repair bad persisted model sentinels - #78641

Merged
kevinslin merged 2 commits into
openclaw:mainfrom
kevinslin:dev/kevinlin/fix-cron-model-doctor-repair
May 6, 2026
Merged

kevinslin merged 2 commits into
openclaw:mainfrom
kevinslin:dev/kevinlin/fix-cron-model-doctor-repair

Conversation

@kevinslin

@kevinslin kevinslin commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Repair persisted cron jobs whose payload.model is stored as "default", "null", blank, or JSON null by deleting the bad model override in openclaw doctor --fix.
  • Keep cron runtime model validation strict: non-empty payload.model strings still resolve as explicit model refs and must pass agents.defaults.models.
  • Add regression coverage plus cron/doctor docs and changelog entry.

Fixes #78549

Verification

  • pnpm changed:lanes --json -> lanes: core, coreTests, docs
  • pnpm check:docs -> passed
  • pnpm exec oxfmt --check --threads=1 src/commands/doctor-cron-store-migration.ts src/commands/doctor-cron.ts src/commands/doctor-cron-store-migration.test.ts src/commands/doctor-cron.test.ts docs/cli/cron.md docs/automation/cron-jobs.md docs/gateway/doctor.md CHANGELOG.md -> passed
  • git diff --check -> passed
  • uvx showboat verify /Users/kevinlin/code/openclaw/.mem/main/proofs/78549-cron-model-doctor-fixed.md -> passed
  • pnpm check:changed -> blocked in local worktree by incomplete dependency install: git-hosted @openclaw/[email protected] failed normal pnpm install prepack twice, and the fallback --ignore-scripts install leaves @openclaw/fs-safe/* exports without built dist files.
  • pnpm test:changed -> blocked before test collection by the same missing @openclaw/fs-safe/config export.

Real behavior proof

  • Behavior or issue addressed: Cron jobs with persisted payload.model sentinels such as "default", "null", blank strings, or JSON null can fail cron preflight as explicit model overrides. This patch gives openclaw doctor --fix a repair path for those bad stored cron configs without supporting default/null runtime fallback aliases.
  • Real environment tested: Local OpenClaw dev checkout with an isolated dev workspace rooted at /Users/kevinlin/code/openclaw/.mem/integ/tmp/doctor-cron-model-sentinel-78549, running the patched CLI from a detached worktree at commit c6a5e2526b86a18ab2233dbb4c9cc8b009a6d8a6.
  • Exact steps or command run after this patch: Seeded state/cron/jobs.json with two bad persisted cron job payload models ("default" and "null") plus one valid real model ("minimax-portal/MiniMax-M2.7"), then ran openclaw doctor --fix --yes --non-interactive through node --import tsx src/entry.ts doctor --fix --yes --non-interactive with OPENCLAW_STATE_DIR pointed at that isolated dev workspace.
  • Evidence after fix: Copied terminal output from the real doctor command and the before/after cron job state:
BEFORE
bad-default payload.model=default
bad-string-null payload.model=null
valid-real-model payload.model=minimax-portal/MiniMax-M2.7

$ env HOME=... OPENCLAW_STATE_DIR=... OPENCLAW_SKIP_CRON=1 OPENCLAW_SKIP_CHANNELS=1 node --import tsx src/entry.ts doctor --fix --yes --non-interactive
Legacy cron job storage detected at /Users/kevinlin/code/openclaw/.mem/integ/tmp/doctor-cron-model-sentinel-78549/state/cron/jobs.json
- 2 jobs store an invalid cron payload model inheritance sentinel
Cron store normalized at /Users/kevinlin/code/openclaw/.mem/integ/tmp/doctor-cron-model-sentinel-78549/state/cron/jobs.json.

AFTER
bad-default payload.model=<missing>
bad-string-null payload.model=<missing>
valid-real-model payload.model=minimax-portal/MiniMax-M2.7
  • Observed result after fix: openclaw doctor --fix removed the bad payload.model overrides for the persisted sentinel values and preserved the valid real model override. Runtime support for "default" or "null" fallback aliases was not added.
  • What was not tested: Targeted Vitest and check:changed could not complete in this worktree because normal pnpm install fails while preparing git-hosted @openclaw/[email protected]; the ignored-scripts fallback leaves @openclaw/fs-safe/config missing its built dist/config.js, so tests fail before collection.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: S maintainer Maintainer-authored PR labels May 6, 2026
@clawsweeper

clawsweeper Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR adds a doctor cron-store migration that removes bad persisted payload.model sentinel values, reports the repair, and updates cron/doctor tests, docs, and changelog while leaving runtime model validation strict.

Reproducibility: yes. Source inspection on current main shows nonempty cron payload.model strings are validated as explicit model refs, and the related report plus prior ClawSweeper review identify the literal default rejection path.

Real behavior proof
Sufficient (terminal): The PR body includes copied after-fix terminal output from a real patched CLI doctor run against an isolated cron store, showing bad model sentinels removed and a real model preserved.

Next step before merge
Human maintainer review is needed because the PR has the protected maintainer label, CI is still queued, and the issue scope depends on accepting doctor-only repair versus fixing the UI clear path.

Security
Cleared: The diff only changes local doctor cron-store normalization plus tests, docs, and changelog; no new dependency, workflow, secret, or supply-chain surface was introduced.

Review details

Best possible solution:

Land the doctor migration if maintainers accept it as the persistence cleanup, and keep or open a separate focused follow-up for any UI/update clear-path behavior that should make inherit-agent-default easier.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection on current main shows nonempty cron payload.model strings are validated as explicit model refs, and the related report plus prior ClawSweeper review identify the literal default rejection path.

Is this the best way to solve the issue?

Unclear as a complete issue fix. The PR is a narrow, maintainable doctor repair for bad persisted state, but maintainer judgment is needed on whether the linked Web UI clear/inherit path should be fixed before this closes the related issue.

What I checked:

  • Protected label: The live PR metadata includes the protected maintainer label, so this workflow should not close or otherwise auto-clean it up. (8e3c18da894c)
  • Current-main failure path: Current main treats any nonempty agent-turn payload.model string as an explicit model override and sends it to resolveAllowedModelRef, which matches the reported rejection for literal default/null strings. (src/cron/isolated-agent/model-selection.ts:112, d05415d6036c)
  • PR repair implementation: The PR branch adds isInvalidCronPayloadModelSentinel and deletes payload.model for agent-turn values null, blank, default, or null during cron doctor normalization. (src/commands/doctor-cron-store-migration.ts:230, 8e3c18da894c)
  • PR regression coverage: The PR branch adds unit coverage for removing sentinel values, preserving real model refs, and persisting the doctor repair through maybeRepairLegacyCronStore. (src/commands/doctor-cron-store-migration.test.ts:109, 8e3c18da894c)
  • PR documentation and changelog: The PR branch documents the doctor repair and explicitly states that runtime still treats nonempty payload.model strings as strict explicit overrides. Public docs: docs/cli/cron.md. (docs/cli/cron.md:161, 8e3c18da894c)
  • Related issue scope: The related reporter comment says the Web UI has no way to set inherit-agent-default and can produce a literal null, so maintainer review should decide whether doctor-only repair is enough or a UI/update clear path remains.

Likely related people:

  • steipete: GitHub file history shows Peter introduced the doctor cron migration helpers, added malformed cron id doctor repair, and authored the strict invalid cron payload model behavior that this patch works around for persisted sentinels. (role: feature introducer and recent maintainer; confidence: high; commits: 2bc8a0d67c9a, b6fbf46ecafe, 343f2d724593; files: src/commands/doctor-cron-store-migration.ts, src/commands/doctor-cron.ts, src/cron/isolated-agent/model-selection.ts)
  • vincentkoc: Current checkout blame points the central doctor and cron model-selection files to Vincent's recent current-main commit, and file history includes related cron/runtime refactors and doctor cron repair gating. (role: recent maintainer; confidence: medium; commits: 1ab00c44699d, 35176f3cb730, d86647d7dbcb; files: src/commands/doctor-cron.ts, src/commands/doctor-cron-store-migration.ts, src/cron/isolated-agent/model-selection.ts)
  • kevinslin: Besides authoring this PR, Kevin has a recent merged current-main cron service repair on the same cron storage/scheduling area, so he is a plausible follow-up owner for this narrow cron doctor path. (role: recent adjacent cron contributor; confidence: medium; commits: 7175b1b5c634; files: src/cron/service/jobs.ts)

Remaining risk / open question:

  • The related issue also names the Web UI blank/null inherit path, while this PR only repairs persisted sentinels through doctor and documents runtime strictness.
  • Head-sha CI was still queued at inspection time, and the PR body says local check:changed and test:changed were blocked in the contributor worktree.

Codex review notes: model gpt-5.5, reasoning high; reviewed against d05415d6036c.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 6, 2026
@kevinslin
kevinslin merged commit 6aafdf1 into openclaw:main May 6, 2026
88 checks passed
@kevinslin
kevinslin deleted the dev/kevinlin/fix-cron-model-doctor-repair branch May 6, 2026 22:31
steipete pushed a commit that referenced this pull request May 7, 2026
* fix(cron): repair bad persisted model sentinels

* test(cron): relax model preservation assertion

(cherry picked from commit 6aafdf1)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(cron): repair bad persisted model sentinels

* test(cron): relax model preservation assertion
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix(cron): repair bad persisted model sentinels

* test(cron): relax model preservation assertion
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix(cron): repair bad persisted model sentinels

* test(cron): relax model preservation assertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron jobs with model: 'default' or null rejected — inherit path broken

1 participant