Skip to content

feat(cron): event triggers — polled condition-watcher scripts via code mode #101194

Description

@steipete

Problem

Watching external state ("tell me when CI on my PR goes green", "ping me when a new P0 issue appears") currently requires heartbeat- or cron-waking the full agent so the model can poll — every check burns tokens, adds latency, and pollutes session context, even when nothing changed. Cron has exactly one event-shaped trigger (on-exit process watcher); everything else is time-based.

Proposal

Add polled condition-watcher triggers to cron: an optional trigger: { script, once? } on every/cron jobs. The gateway evaluates the JavaScript condition headlessly in the existing code-mode QuickJS sandbox on each due tick — with the owning agent's tool policy and persisted trigger.state for change detection — and runs the normal payload only when the script returns fire: true. Quiet ticks cost no tokens and leave no run history.

Poll-over-push keeps core wiring at zero per source: anything a tool can reach becomes a trigger source. Push sources (webhooks/hook bus) can later feed the same script contract. Gated by cron.triggers.enabled (default off) since enabled installs run agent-authored scripts headlessly with the agent's full toolset.

Design discussed and approved with @steipete (poll model, tool inheritance, config gate, long-term convergence of event sources onto this pipeline).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.maintainerMaintainer-authored PR

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions