Skip to content

feat(cron): outbound signed webhook delivery target for cron results and approval requests #911

Closed

Description

@ajianaz

What problem does this solve?

Part of the gateway epic (#910). Cron delivery targets today are log, session, file:PATH and command:ARGV (crates/tole-cli/src/cron/deliver.rs). There is no outbound push to a client, and approval requests are not pushed either. A chat gateway would have to hold one SSE stream per session (the server caps streams at 8) or poll GET /cron/runs and GET /approvals. A command: target could shell out to curl, but it is only allowed for trusted jobs and is not signed.

Proposed solution

Owner decision 2026-11-17: add an outbound webhook delivery target so cron results and approval requests reach a gateway without holding streams.

  • A named destination is declared in the user config only (never in a project config and never chosen by a job or by agent-written text): URL, secret source (env or the existing secret mechanism, never inline), optional allowed events. A cron job refers to it by name, for example delivery = "webhook:gateway".
  • Events: a finished cron run (result summary, job, run id, status) and approval_requested / approval_resolved for approvals that park a run or a session turn (approval id, tool, risk tier, session id).
  • Payload goes through SecretSet::redact like every other sink, is size-capped, and carries a stable event id (idempotency key).
  • Authentication: HMAC-SHA256 over timestamp + body in headers, in the same style as the inbound POST /hooks/<route> gate (feat(serve): webhook routes that fire cron jobs (HMAC, idempotency, filters) #582), so a receiver can verify and reject replays.
  • Delivery: at-least-once with bounded retries and backoff, then a ledger line and a doctor warning; delivery never blocks the turn or the cron tick.
  • Network policy: only the destinations named in the user config are reachable; loopback must be allowed explicitly (a local gateway needs it); redirects are not followed; no private-range access unless the destination is configured for it.
  • Design before code: a short design note in docs/automation-design.md first, then implementation. This touches an outbound data path, so it needs an independent read-only review before the PR is opened, and cora callers/impact output in the PR body.

Alternatives considered

  • The gateway polls GET /cron/runs and GET /approvals: no kernel change, but latency and wasted requests; usable as a fallback.
  • The gateway holds SSE streams: hits the cap of 8 and loses ephemeral frames on reconnect.
  • command: target with curl: unsigned and trusted-jobs-only.

Are you willing to contribute the implementation?

Yes, I can do it

Before submitting

  • I searched existing issues and didn't find a duplicate

Activity

  1. added
    enhancement
    on Nov 17, 2026
  2. added 20 commits that reference this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions