Skip to content

fix(cron): accept null fallbacks in update patch payload (#100707)#100801

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/cron-fallback-null-clear-100707
Jul 6, 2026
Merged

fix(cron): accept null fallbacks in update patch payload (#100707)#100801
vincentkoc merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/cron-fallback-null-clear-100707

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

cron update --patch '{"payload":{"fallbacks":null}}' fails with Validation failed: patch.payload.fallbacks: must be array, blocking users from clearing per-job fallback overrides to restore global agent defaults.

  • Problem: cronPayloadObjectSchema hardcodes fallbacks as Type.Optional(Type.Array(Type.String())) — non-nullable — while model and toolsAllow are parameterized so the patch context can pass nullable variants
  • Solution: Add fallbacks as a parameter to cronPayloadObjectSchema, matching the existing pattern for model and toolsAllow
  • What changed: src/agents/tools/cron-tool.ts (schema parameter + both callers), src/agents/tools/cron-tool.schema.test.ts (null fallback test)
  • What did NOT change: Config schema (zod-schema.agent-model.ts), Gateway types (cron/types.ts), service layer (cron/service/jobs.ts) — all already support null clears

Change Type (select all)

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

Scope (select all)

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

Linked Issue/PR

Motivation

Users need to clear per-job fallbacks overrides so cron jobs inherit the global agent-level default fallbacks. The CLI (--clear-fallbacks) and Gateway service (mergeCronPayload) already support this, but the tool schema rejects null before it reaches the service layer. This is the last remaining gap after the model null-clear fix in cfeaf6897f (#93369 follow-up).

Evidence

  • Behavior addressed: cron update --patch now accepts payload.fallbacks: null for clear-to-inherit
  • Real environment tested: Linux, Node 22, branch fix/cron-fallback-null-clear-100707

Exact steps before and after this patch:

$ node --import tsx -e "import { Value } from 'typebox/value'; import { createCronToolSchema } from './src/agents/tools/cron-tool.ts'; ..."

=== BEFORE fix (main branch) ===
patch fallbacks=null  => REJECTED
patch fallbacks=[...] => PASS
create fallbacks=null => REJECTED (strict)

=== AFTER fix (nullable fallbacks) ===
patch fallbacks=null  => ✅ PASS (fixed)
patch fallbacks=[...] => ✅ PASS
patch model=null      => ✅ PASS (already worked)
create fallbacks=null => ✅ REJECTED (strict create)

Unit test results:

$ pnpm test src/agents/tools/cron-tool.schema.test.ts
 Test Files  1 passed (1)
      Tests  18 passed (18)   # +1: "accepts payload.fallbacks null in patch"

$ pnpm test src/agents/tools/cron-tool.test.ts
 Test Files  1 passed (1)
      Tests  137 passed (137)

Schema comparison (before vs after):

Input Before After
patch.payload.fallbacks: null Value.Check → false Value.Check → true
patch.payload.fallbacks: ["gpt-5"] Value.Check → true Value.Check → true
create job.payload.fallbacks: null Value.Check → false Value.Check → false (unchanged)
  • Observed result after fix: Before: null fallbacks rejected by tool schema, never reaching Gateway service. After: null accepted, reaches service layer which correctly clears the stored override.
  • What was not tested: No live Gateway cron update --patch E2E (requires running Gateway with persistent cron state); the schema-level proof covers the reported rejection path because that path is purely a schema validation gate

Root Cause (if applicable)

Commit cfeaf6897f parameterized model in cronPayloadObjectSchema to enable null clears for the patch context, but did not extend the same parameterization to fallbacks. The field remained hardcoded as Type.Optional(Type.Array(Type.String())).

User-visible / Behavior Changes

Users can now run cron update --patch '{"payload":{"fallbacks":null}}' to clear per-job fallbacks and revert to global agent defaults.

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

Human Verification (required)

  • Verified scenarios: Value.Check for create schema (non-nullable), patch schema (nullable), and array acceptance
  • Edge cases checked: null rejected in create context (unchanged), null accepted in patch context (fixed), non-array non-null rejected (unchanged)
  • What you did NOT verify: Live Gateway cron update E2E

Compatibility / Migration

  • Backward compatible? Yes — null was previously rejected, now accepted. No existing valid input breaks.
  • Config/env changes? No
  • Migration needed? No

Best-fix Verdict

  • Best fix: Yes — parameterizing fallbacks is the exact same pattern used for model and toolsAllow in the same function
  • Refactor needed: No
  • Alternative considered: Making fallbacks directly nullable in cronPayloadObjectSchema (simpler but would also accept null in create context, which is semantically unnecessary)

AI Assistance 🤖

  • AI-assisted: Yes
  • Co-Authored-By: Claude [email protected]
  • Human confirmed understanding of code changes: Yes

Risks and Mitigations

None — narrow schema change. The patch context was already designed to accept nullable fields; fallbacks was simply missed. All existing tests pass.

@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 9:13 AM ET / 13:13 UTC.

Summary
The PR parameterizes fallbacks in the cron tool payload schema, passes a nullable schema only for update patches, adds runtime schema coverage for model and fallbacks null clears, and updates affected Codex prompt snapshots.

PR surface: Source +6, Tests +36. Total +42 across 8 files.

Reproducibility: yes. Source inspection shows current main and v2026.6.11 keep patch.payload.fallbacks non-null in createCronToolSchema(), while the protocol and service already accept and clear null fallbacks.

Review metrics: 1 noteworthy metric.

  • Cron patch clear schema: 1 nullable field added. The PR intentionally adds one nullable clear path to the model-facing cron update schema while preserving strict create payloads.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #100707
Summary: The linked issue is the canonical cron tool-schema null-clear bug; this PR is the current proof-positive candidate fix, while sibling PRs either target the wrong layer or duplicate this branch with weaker landing evidence.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • [P2] No separate fix job is needed because this PR already contains the narrow code, test, and snapshot update for the linked issue.

Security
Cleared: The diff only changes TypeBox schema wiring, a focused schema test, and prompt snapshots; it adds no dependencies, scripts, permissions, secret handling, or supply-chain surface.

Review details

Best possible solution:

Land this narrow cron tool schema fix after ordinary maintainer review, keeping create/config schemas strict while reusing the existing protocol and service null-clear behavior.

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

Yes. Source inspection shows current main and v2026.6.11 keep patch.payload.fallbacks non-null in createCronToolSchema(), while the protocol and service already accept and clear null fallbacks.

Is this the best way to solve the issue?

Yes. This PR fixes the exact TypeBox cron tool patch schema gate and adds focused runtime schema coverage, rather than broadening config schemas or changing service code that already supports null clears.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5aa7c6267cc0.

Label changes

Label justifications:

  • P2: This is a focused cron fallback-clear bug with limited blast radius and a workaround of recreating affected jobs.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes before/after terminal Value.Check(createCronToolSchema()) output and targeted test output for the exact schema-validation gate changed by the patch.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes before/after terminal Value.Check(createCronToolSchema()) output and targeted test output for the exact schema-validation gate changed by the patch.
Evidence reviewed

PR surface:

Source +6, Tests +36. Total +42 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 1 8 2 +6
Tests 7 63 27 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 71 29 +42

What I checked:

Likely related people:

  • brunolorente: Commit ca76e2f... added typed cron job/patch schema properties and adjacent schema tests that define the validation layer this PR fixes. (role: introduced typed cron tool schema surface; confidence: high; commits: ca76e2fedc8e; files: src/agents/tools/cron-tool.ts, src/agents/tools/cron-tool.schema.test.ts)
  • 849261680: Commit 1662b07... added shipped CLI/protocol/service fallback clear behavior that this tool-schema change makes reachable from agent tool calls. (role: recent cron fallback contributor; confidence: high; commits: 1662b07810eb; files: src/cli/cron-cli/register.cron-edit.ts, src/cron/service/jobs.ts, packages/gateway-protocol/src/schema/cron.ts)
  • openperf: Commit 8c1ca1f... recently adjusted the same cron tool schema and schema tests for provider-compatible JSON Schema output. (role: recent cron tool schema contributor; confidence: medium; commits: 8c1ca1f24517; files: src/agents/tools/cron-tool.ts, src/agents/tools/cron-tool.schema.test.ts)
  • lzw112: Current-line blame on main attributes the carried-forward cron tool schema block to a recent broad commit, so this is a weak routing signal compared with the feature-specific PR history. (role: recent area contributor; confidence: low; commits: 22dfb15048; files: src/agents/tools/cron-tool.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed 2026-07-06T10:39:54.056Z sha a3b7a2b :: needs maintainer review before merge. :: none
  • reviewed 2026-07-06T12:25:55.878Z sha c2d0962 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 6, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/cron-fallback-null-clear-100707 branch from b02c8d4 to 1b84c39 Compare July 6, 2026 11:56
createCronPatchObjectSchema passes nullableStringArraySchema for model and
toolsAllow, but fallbacks was still hardcoded as a non-nullable array in
cronPayloadObjectSchema, rejecting null clears before they reach the
Gateway service layer.

Switch fallbacks to a parameter so the patch context can pass the nullable
variant, matching the existing pattern for model and toolsAllow.

Fixes openclaw#100707

Co-Authored-By: Claude <[email protected]>
@SunnyShu0925
SunnyShu0925 force-pushed the fix/cron-fallback-null-clear-100707 branch from 1b84c39 to c2d0962 Compare July 6, 2026 11:58
@vincentkoc
vincentkoc merged commit a98a646 into openclaw:main Jul 6, 2026
96 checks passed
@vincentkoc vincentkoc self-assigned this Jul 6, 2026
LinuxMum added a commit to LinuxMum/openclaw that referenced this pull request Jul 6, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
…0707) (openclaw#100801)

* fix(cron): accept null fallbacks in cron update patch payload

createCronPatchObjectSchema passes nullableStringArraySchema for model and
toolsAllow, but fallbacks was still hardcoded as a non-nullable array in
cronPayloadObjectSchema, rejecting null clears before they reach the
Gateway service layer.

Switch fallbacks to a parameter so the patch context can pass the nullable
variant, matching the existing pattern for model and toolsAllow.

Fixes openclaw#100707

Co-Authored-By: Claude <[email protected]>

* test(cron): cover model+fallbacks null clear in patch schema test

---------

Co-authored-by: Claude <[email protected]>
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
…0707) (openclaw#100801)

* fix(cron): accept null fallbacks in cron update patch payload

createCronPatchObjectSchema passes nullableStringArraySchema for model and
toolsAllow, but fallbacks was still hardcoded as a non-nullable array in
cronPayloadObjectSchema, rejecting null clears before they reach the
Gateway service layer.

Switch fallbacks to a parameter so the patch context can pass the nullable
variant, matching the existing pattern for model and toolsAllow.

Fixes openclaw#100707

Co-Authored-By: Claude <[email protected]>

* test(cron): cover model+fallbacks null clear in patch schema test

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: cron tool schema rejects null for payload.model/fallbacks, blocking clear-to-inherit

2 participants