Skip to content

Commit 4195c0c

Browse files
committed
feat(cron): expose --fallbacks flag on cron add/create and edit commands (fixes #90302)
1 parent 4560597 commit 4195c0c

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/cli/cron-cli/register.cron-add.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ export function registerCronAddCommand(cron: Command) {
128128
.option("--no-output-timeout-seconds <n>", "No-output timeout seconds for command jobs")
129129
.option("--output-max-bytes <n>", "Maximum captured stdout/stderr bytes for command jobs")
130130
.option("--light-context", "Use lightweight bootstrap context for agent jobs", false)
131+
.option(
132+
"--fallbacks <list>",
133+
"Comma-separated fallback models for agent jobs (e.g. anthropic/claude-haiku-4-5,openai/gpt-5)",
134+
)
131135
.option("--tools <list>", "Tool allow-list (e.g. exec,read,write or exec read write)")
132136
.option("--announce", "Fallback-deliver final text to a chat", false)
133137
.option("--deliver", "Deprecated (use --announce). Fallback-delivers final text to a chat.")
@@ -259,6 +263,7 @@ export function registerCronAddCommand(cron: Command) {
259263
timeoutSeconds && Number.isFinite(timeoutSeconds) ? timeoutSeconds : undefined,
260264
lightContext: opts.lightContext === true ? true : undefined,
261265
toolsAllow: parseCronToolsAllow(opts.tools),
266+
fallbacks: parseCronToolsAllow(opts.fallbacks),
262267
};
263268
})();
264269

src/cli/cron-cli/register.cron-edit.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ export function registerCronEditCommand(cron: Command) {
122122
.option("--output-max-bytes <n>", "Maximum captured stdout/stderr bytes for command jobs")
123123
.option("--light-context", "Enable lightweight bootstrap context for agent jobs")
124124
.option("--no-light-context", "Disable lightweight bootstrap context for agent jobs")
125+
.option(
126+
"--fallbacks <list>",
127+
"Comma-separated fallback models for agent jobs (e.g. anthropic/claude-haiku-4-5,openai/gpt-5)",
128+
)
129+
.option("--clear-fallbacks", "Remove per-job fallback model list", false)
125130
.option("--tools <list>", "Tool allow-list (e.g. exec,read,write or exec read write)")
126131
.option("--clear-tools", "Remove tool allow-list (use all tools)", false)
127132
.option("--announce", "Fallback-deliver final text to a chat")
@@ -289,6 +294,10 @@ export function registerCronEditCommand(cron: Command) {
289294
throw new Error("Use --model or --clear-model, not both");
290295
}
291296
const thinking = normalizeOptionalString(opts.thinking);
297+
const fallbacks = parseCronToolsAllow(opts.fallbacks);
298+
if (fallbacks && opts.clearFallbacks) {
299+
throw new Error("Use --fallbacks or --clear-fallbacks, not both");
300+
}
292301
const toolsAllow = parseCronToolsAllow(opts.tools);
293302
const rawTimeoutSeconds =
294303
opts.timeoutSeconds === undefined ? undefined : String(opts.timeoutSeconds).trim();
@@ -380,7 +389,9 @@ export function registerCronEditCommand(cron: Command) {
380389
typeof opts.lightContext === "boolean" ||
381390
typeof opts.tools === "string" ||
382391
Array.isArray(opts.tools) ||
383-
opts.clearTools;
392+
opts.clearTools ||
393+
Boolean(fallbacks) ||
394+
Boolean(opts.clearFallbacks);
384395
const hasCommandPayloadField =
385396
hasCommandSpecificPayloadField ||
386397
(hasTimeoutSeconds &&
@@ -418,6 +429,11 @@ export function registerCronEditCommand(cron: Command) {
418429
} else if (toolsAllow) {
419430
payload.toolsAllow = toolsAllow;
420431
}
432+
if (opts.clearFallbacks) {
433+
payload.fallbacks = null;
434+
} else if (fallbacks) {
435+
payload.fallbacks = fallbacks;
436+
}
421437
patch.payload = payload;
422438
} else if (hasCommandPatch) {
423439
const payload: Record<string, unknown> = { kind: "command" };

0 commit comments

Comments
 (0)