Scion Triggers: how the pieces fitState as of 2026-11-17 03:15 UTC

The core model

Five nouns, used the same way by every source. The scheduler already implemented most of them for the clock; the Triggers work generalises them.

Sourcekind = code (curated)instance = row Eventone normalised envelopestored in the inbox Trigger (rule)types + match + subjectpolicy + action spec ActionValidate · Authorize ·Fire, against a target Fire recordone per (event, trigger)outcome + result ref emits matches runs records id · project · source kind/id · type subject · dedup key · attributes bounded payload ·allow-listed headers project-scoped, name unique enabled / paused, with reason carries the creator’s recorded authority (schedule mixins) fired · failed · refused · skipped (S2 adds waiting, expired; S3 coalescing) A schedule is a trigger whose source is the clock and whose match is “every fire”. Its row maps field for field onto a trigger row (a Stage 1 acceptance criterion).
The model from the agreed plan (§3). Sources never run actions; they only authenticate, bound, normalise, resolve the project and hand the event to the inbox.

Event types and subjects

Event types are dotted and source-prefixed: schedule.fired, webhook.received (or webhook.<X-Scion-Event>), github.pull_request.opened. Every source also fills a subject, a stable key for “the thing this event is about”:

SourceSubject
webhookwebhook:<endpoint-id>[/<X-Scion-Subject>]
githubgithub:owner/repo#N (push: github:owner/repo@ref)
scheduleschedule:<id>
chat (Stage 4)chat:<conversation>

A rule can override the subject with its own expression (for example an order id from the payload). The subject policy on the trigger then decides what a second event for the same subject does. The policy is source-agnostic: the drainer never looks at the source kind (decision D5).

ModeMeaningWhen
newEvery matching event fires.Stage 1
skipIf a live fire for this (trigger, subject) exists, record skipped "subject busy".Stage 1 PR 4; Stage 2 adds a subject-claims table
reuseIf the subject already has a running agent from this trigger, deliver the event to it as a message (with wake) instead of dispatching another.Stage 3 (G4), over Stage 2’s claims

Stage 3 also adds coalesce_window (latest event wins, maximum 10 minutes; presets use 30 s to fold synchronize bursts).

The durable inbox

Ingress verifies, stores the event and enqueues a work item in the same transaction, then answers 202. Agreed decision D3 required the queue to be a reusable, hub-wide primitive rather than a trigger table, so it lives in pkg/durablequeue with no trigger types in it:

Where the fire core and authority checks sit

Claim fireINSERT (event, trigger)unique → no double fire Resolve authorityrecorded principal +revision, fail closed Action.Authorizefrozen ceiling · live authz· standing Action.Firedeliver / create / exec /comment Finish (CAS)fired / failed / skippedcounters, audit Denied → fire “refused” (counts as an error)schedules map refused → failed, so schedule behaviour is unchanged
Stage 1 design §5.2. The core (firecore_*.go, action_*.go) stays in package hub; new trigger code lives in pkg/hub/trigger and the shared types in pkg/hub/hubfire (decision D-S1-1).

Authority is the scheduler’s model, inherited rather than reinvented: at authoring the hub records the creator’s principal, credential and an authorization_revision, and freezes an effect ceiling. Any edit that changes a future fire bumps the revision. At every fire the hub re-resolves that authority, checks the ceiling, re-runs the live permission check for the action on its target, and checks standing. If the creator is deleted the trigger pauses (creator_deleted); a deleted message target pauses it with target_deleted; a deleted endpoint with source_deleted. No trigger can do more than its creator could do interactively at fire time.

Curated source kinds vs user-created endpoints and rules

A source kind is Go code chosen by Scion; the set is closed (Stage 1 accepts only webhook on the trigger API). Users create instances, a webhook endpoint or a schedule, and triggers that point at them. GitHub has no per-user instance: the hub’s single App is the source, scoped to a project by the existing installation association. This was settled by ptone on 2026-11-16 when the question arose whether to keep the raw trigger API public: Trigger CRUD stays public; defining a new source kind is not an API.