Skip to content

cron: delivery (announce to channel) for script payload jobs #21

@Arry8

Description

@Arry8

Summary

Script cron jobs (payload.kind: "script") currently run via execCronScript and return a bare CronRunOutcome with no delivered/deliveryAttempted fields. The announce/delivery pipeline is never invoked.

Problem

agentTurn jobs get delivery via runIsolatedAgentJob which bundles the full run + announce in one dep call. There is no equivalent dep for script output delivery. As a result, --announce / --channel / --to flags are accepted at CLI creation time but silently have no effect at runtime.

Acceptance Criteria

  • A new CronServiceDeps function (e.g. sendCronScriptResult) allows delivering script stdout to a configured channel
  • executeJobCore calls it after execCronScript returns when delivery is requested
  • delivered and deliveryAttempted are correctly populated in the returned result
  • Existing script jobs without delivery config are unaffected

Implementation Plan

  1. Add sendCronScriptResult (or similar) to CronServiceDeps in state.ts
  2. Implement the dep in the gateway (reuse announce machinery from isolated job delivery)
  3. In executeJobCore, after execCronScript, call the dep when resolveCronDeliveryPlan(job).requested
  4. Return { ...scriptResult, delivered, deliveryAttempted } from the script branch

Files Affected

  • src/cron/service/state.ts — new dep
  • src/cron/service/timer.ts — call dep after execCronScript
  • Gateway wiring (wherever runIsolatedAgentJob dep is implemented)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions