fix(cron): warn when isolated job won't deliver output

When creating an isolated cron job with --message but without --deliver
or --to, the job runs but the agent output goes nowhere. This is a
common mistake that's hard to debug.

Add a warning at job creation time so users know they need to add
--deliver --channel <channel> --to <dest> for proactive message delivery.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matthias Röder 2026-01-26 14:55:27 +01:00
parent 68824c8903
commit f88c4ada68

View File

@ -177,6 +177,19 @@ export function registerCronAddCommand(cron: Command) {
throw new Error("Isolated jobs require --message (agentTurn).");
}
// Warn if isolated job won't deliver output anywhere
if (
sessionTarget === "isolated" &&
payload.kind === "agentTurn" &&
!payload.deliver &&
!payload.to
) {
defaultRuntime.error(
"warning: isolated job has --message but no --deliver or --to; agent output will not be sent.\n" +
"Add --deliver --channel <channel> --to <dest> if you want proactive message delivery.",
);
}
const isolation =
sessionTarget === "isolated"
? {