fix(cron): avoid agent warning for command jobs (#112043)

This commit is contained in:
Peter Steinberger
2026-07-20 21:25:29 -07:00
committed by GitHub
parent db482e6e97
commit be009ee557
2 changed files with 16 additions and 3 deletions
+15
View File
@@ -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",
+1 -3
View File
@@ -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(