fix: cron announce delivery path (#8540) (thanks @tyler6204)

This commit is contained in:
Peter Steinberger
2026-02-04 01:01:29 -08:00
parent c396877dd9
commit 6341819d74
7 changed files with 82 additions and 97 deletions

View File

@@ -188,12 +188,15 @@ export async function executeJob(
// Post a short summary back to the main session so the user sees
// the cron result without opening the isolated session.
const summaryText = res.summary?.trim();
if (summaryText) {
const deliveryMode = job.delivery?.mode ?? "announce";
if (summaryText && deliveryMode !== "none") {
const prefix = "Cron";
const label =
res.status === "error" ? `${prefix} (error): ${summaryText}` : `${prefix}: ${summaryText}`;
state.deps.enqueueSystemEvent(label, { agentId: job.agentId });
state.deps.requestHeartbeatNow({ reason: `cron:${job.id}` });
if (job.wakeMode === "now") {
state.deps.requestHeartbeatNow({ reason: `cron:${job.id}` });
}
}
if (res.status === "ok") {