From be009ee5570fccd2c32aecd36975304d95b02320 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 20 Jul 2026 21:25:29 -0700 Subject: [PATCH] fix(cron): avoid agent warning for command jobs (#112043) --- src/cli/cron-cli.test.ts | 15 +++++++++++++++ src/cli/cron-cli/register.cron-add.ts | 4 +--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/cli/cron-cli.test.ts b/src/cli/cron-cli.test.ts index 876c7bd5562d..30cad82c528d 100644 --- a/src/cli/cron-cli.test.ts +++ b/src/cli/cron-cli.test.ts @@ -1021,6 +1021,21 @@ describe("cron cli", () => { expectNoRuntimeErrorContaining("No --agent specified"); }); + it("does not warn when --command is used (no agent needed)", async () => { + await runCronCommand([ + "cron", + "add", + "--name", + "Command", + "--cron", + "* * * * *", + "--command", + "printf ok", + ]); + + expectNoRuntimeErrorContaining("No --agent specified"); + }); + it("warns even when --session-key is provided (user should still specify agent explicitly)", async () => { await runCronCommand([ "cron", diff --git a/src/cli/cron-cli/register.cron-add.ts b/src/cli/cron-cli/register.cron-add.ts index 347ae4f1f0a3..f2a3d41007a1 100644 --- a/src/cli/cron-cli/register.cron-add.ts +++ b/src/cli/cron-cli/register.cron-add.ts @@ -454,9 +454,7 @@ export function registerCronAddCommand(cron: Command) { : undefined; if ( - (resolvedPayload.kind === "agentTurn" || - resolvedPayload.kind === "command" || - resolvedPayload.kind === "script") && + (resolvedPayload.kind === "agentTurn" || resolvedPayload.kind === "script") && !agentId ) { defaultRuntime.error(