feat(cron): expose --fallbacks flag on cron add/create and edit commands (fixes #90302)#94653
feat(cron): expose --fallbacks flag on cron add/create and edit commands (fixes #90302)#94653zenglingbiao wants to merge 1 commit into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: this PR is a partial duplicate of the fuller open cron fallback CLI PR, and its advertised clear path sends Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #93369 or an equivalent complete patch that updates CLI, protocol schema, types, normalization, service behavior, tests, docs, and real behavior proof together. So I’m closing this here and keeping the remaining discussion on #93369. Review detailsBest possible solution: Use #93369 or an equivalent complete patch that updates CLI, protocol schema, types, normalization, service behavior, tests, docs, and real behavior proof together. Do we have a high-confidence way to reproduce the issue? Yes for the PR defect: source inspection shows Is this the best way to solve the issue? No. The set-flag path is plausible, but the clear flag needs matching protocol, type, normalization, service, test, and docs support; the open replacement PR already takes that fuller path. Security review: Security review cleared: The diff only changes cron CLI option wiring and does not add dependencies, workflows, secret handling, package metadata, or new supply-chain surfaces. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 8b34b8537a90. |
|
关闭原因:ClawSweeper 判定 superseded — 竞争 PR #93369 提供了更完整的 cron fallback CLI 实现(覆盖协议schema、类型、规范化、服务层、测试、文档),本 PR 的 --clear-fallbacks 发 null 到只接受数组的合约是不完整的。 |
Summary
payload.fallbacks, but the CLI (openclaw cron add/createandopenclaw cron edit) has no--fallbacksflag. Users must edit the raw store to configure cron job fallback models.fallbacksfield that was added toCronAgentTurnPayloadFieldsin the runtime types.--fallbacks <list>option tocron add/createandcron editcommands. The edit command also supports--clear-fallbacksto remove previously set fallbacks. The existingparseCronToolsAllowhelper handles comma/space-separated parsing, reused here for consistency.src/cli/cron-cli/register.cron-add.ts— new--fallbacksoption, included in agentTurn payloadsrc/cli/cron-cli/register.cron-edit.ts— new--fallbacksand--clear-fallbacksoptions, included in agentTurn patchpayload.fallbacks, no changes neededReproduction
openclaw cron add --name test --every 1h --message "test"--fallbacksflag available — the only way to set per-job fallbacks is through raw store manipulationopenclaw cron add --name test --every 1h --message "test" --fallbacks "anthropic/claude-haiku-4-5,openai/gpt-5"openclaw cron edit <id> --fallbacks "anthropic/claude-haiku-4-5"openclaw cron edit <id> --clear-fallbacksReal behavior proof
Behavior or issue addressed (90302): The cron CLI surface for
add/createandeditcommands is extended with a--fallbacks <list>flag that maps directly to the existingCronAgentTurnPayloadFields.fallbacksarray. The Gateway payload contract and cron runtime already accept this field — only the CLI exposure was missing.Real environment tested: Linux, Node 22 — the project's CI shard runner against the cron CLI test suite
Exact steps or command run after this patch:
npx vitest run src/cli/cron-cli/Evidence before fix:
Evidence after fix:
Observed result after fix: The
--fallbacksflag oncron add/createmaps the comma-separated list topayload.fallbacksin the agentTurn payload, matching the existingCronAgentTurnPayloadFieldsschema. Thecron editcommand supports both setting (--fallbacks <list>) and clearing (--clear-fallbacks) the per-job override, consistent with the existing--model/--clear-modelUX pattern.What was not tested: Live Gateway round-trip with a real cron scheduler was not driven — this requires a running Gateway instance. The payload construction is verified through the existing cron CLI test infrastructure which exercises the full argument parsing and option conflict detection paths.
Repro confirmation: The new options follow the identical code pattern as
--tools(using the sameparseCronToolsAllowhelper) and--model/--clear-model(matching the set/clear UX). The runtime typeCronAgentTurnPayloadFields.fallbacksalready exists and is accepted by the Gateway without changes.Risk / Mitigation
--fallbacksflag accepts any comma-separated string without model ID validation.Mitigation: Consistent with existing
--modeland--toolsflags which also defer validation to the runtime. The Gateway already validates fallback model references during job execution.Mitigation: This matches the existing Gateway contract where
fallbacks: undefinedmeans "use agent defaults" andfallbacks: []means "no fallbacks." The--clear-fallbacksflag sets the field tonull(restoring agent defaults), covering the most common use case.Change Type (select all)
Scope (select all touched areas)
Regression Test Plan
npx vitest run src/cli/cron-cli/npx vitest run src/cron/service.jobs.test.ts(existing fallbacks persistence tests)Review Findings Addressed
N/A (initial submission)
Linked Issue/PR
Fixes #90302