Triggers & Webhooks
Triggers let external systems—CI pipelines, issue trackers, payment providers, monitoring tools, or other Scion agents—deliver events to a project and run automated actions under your recorded authority.
Concepts
Section titled “Concepts”A trigger pipeline moves through five resources (defined in the Glossary):
- Source — an origin that emits events into a project’s inbox. For general webhooks, a source is a project-owned webhook endpoint (
source_kind: "webhook"). Projects can also attach triggers to a GitHub App repository source (source_kind: "github", gated onhub.github_triggers). - Event — an immutable inbox record (
trigger_events) captured when a source delivers a verified request. Events are retained for 7 days and processed asynchronously through the Hub’s durable queue (trigger.event). - Trigger — a project-scoped rule attached to a source. It filters events by
typesand an optional ordered list of rule elements (where), optionally derives a concurrency subject, and executes one or more ordered actions under the authoring principal’s recorded authority. - Action — the operation performed when a trigger matches:
message(deliver an event envelope to an agent),dispatch_agent(create and start an agent from a template),exec(run a command over Conduit), orgithub.comment(for GitHub App sources). A single trigger can run up to 8 ordered actions per matched event. - Fire — one execution attempt of one action of a trigger for a specific event (
trigger_fires, unique per(event_id, trigger_id, action_index)). A fire moves from a non-terminal status (coalescing,deferred,firing, orwaitingwhen queued offline) to a terminal status:fired,skipped,failed,refused, orexpired.
Webhook Endpoints
Section titled “Webhook Endpoints”Webhook endpoints are project-owned (POST /api/v1/hooks/{id}) and managed with scion trigger webhook.
Creating an endpoint
Section titled “Creating an endpoint”scion trigger webhook create --name deploys --description "CI deploy callbacks"For HMAC endpoints (the default), the Hub generates a 32-byte base64url signing secret and prints it once in the creation output alongside the endpoint URL. Save the secret immediately; subsequent get and list calls never return it. Per-signature-mode curl + openssl sender examples are available in scion trigger webhook create --help and in the Web UI’s endpoint creation dialog.
Authentication modes (--auth)
Section titled “Authentication modes (--auth)”| Mode | Flag | How senders authenticate |
|---|---|---|
hmac (default) |
--auth hmac |
Signed HTTP request verified with the endpoint’s HMAC secret according to --signature-mode. Do not send an Authorization header to an HMAC endpoint—an invalid credential is rejected with 401 before the HMAC signature is checked. |
hub_token |
--auth hub_token |
Standard Hub bearer credential (user session bearer, a User Access Token with the webhook_endpoint:send scope, or an authorized agent token). No HMAC header is required. |
For hub_token endpoints:
- Project members, admins, and owners hold
webhook_endpoint.sendby default. - Agent senders must be in the same project and hold
project:agent:notify(including the owning agent and the bound agent); by default only the owning agent and bound agent may send, or any same-project agent holdingproject:agent:notifywhen--allow-project-agentsis enabled (off by default). - Unsigned
X-Scion-Event,X-Scion-Subject, andX-Scion-Deliveryheaders are honoured because the caller is authenticated.attributes.signature_modeis"hub_token",attributes.senderrecords<principal kind>:<id>, andexternal_payload.verifiedis"hub-token". - Use unpredictable (UUID) delivery IDs: deduplication is keyed on
(endpoint, delivery)and is not scoped by sender. Any authorized sender on ahub_tokenendpoint can pre-claim a predictable delivery ID, causing a later sender’s delivery with that ID to be dropped as202 duplicate.
Signature modes (--signature-mode)
Section titled “Signature modes (--signature-mode)”When --auth hmac is selected, choose the signature format that matches your sender:
| Mode | Header & canonical string | Replay protection | Routing fields |
|---|---|---|---|
scion_v1 (default) |
X-Scion-Signature: t=<unix>,v1=<hex> over "v1\n" + t + "\n" + X-Scion-Delivery + "\n" + X-Scion-Event + "\n" + X-Scion-Subject + "\n" + body |
Yes (±replay_window_seconds, default 300, range 30–900) |
Signed X-Scion-Event (webhook.<name>), X-Scion-Subject, X-Scion-Delivery; optional routing hints fill only empty fields |
stripe_v1 |
Stripe-Signature: t=<unix>,v1=<hex> over "<t>.<body>" |
Yes (±replay_window_seconds) |
Routing hints, defaulting to /type, /data/object/id, /id |
github_v1 |
X-Hub-Signature-256: sha256=<hex> over raw body only |
No (GitHub signs only the body) | Unsigned X-GitHub-Event (webhook.<event>) and X-GitHub-Delivery; optional --subject-path (e.g. /repository/full_name) |
scion_v1 sender example
Section titled “scion_v1 sender example”HOOK_URL="https://hub.example.com/api/v1/hooks/<endpoint-id>"SECRET="<one-time-secret>"TS="$(date +%s)"DELIVERY="$(uuidgen 2>/dev/null || date +%s%N)"# X-Scion-Event: <name> sets event.type=webhook.<name> (default webhook.received rules then stop matching; use --type webhook.<name>)EVENT=""# X-Scion-Subject is stored as event.subject=webhook:<endpoint-id>/<subject>SUBJECT=""BODY='{"status":"ok","commit":"abc1234"}'SIG="$(printf 'v1\n%s\n%s\n%s\n%s\n%s' "$TS" "$DELIVERY" "$EVENT" "$SUBJECT" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | awk '{print $NF}')"curl -fsS -X POST "$HOOK_URL" \ -H "Content-Type: application/json" \ -H "X-Scion-Signature: t=${TS},v1=${SIG}" \ -H "X-Scion-Delivery: ${DELIVERY}" \ -H "X-Scion-Event: ${EVENT}" \ -H "X-Scion-Subject: ${SUBJECT}" \ --data-raw "$BODY"Requests must use Content-Type: application/json and a valid JSON body. Pay attention to the X-Scion-Event and X-Scion-Subject headers:
X-Scion-Event: <name>setsevent.typetowebhook.<name>. Omitting it (or sending an empty header) setswebhook.received. Once you send a non-emptyX-Scion-Event, defaultwebhook.receivedtriggers stop matching until updated with--type webhook.<name>.X-Scion-Subject: <value>setsevent.subjecttowebhook:<endpoint-id>/<value>(the raw unprefixed value is stored inevent.attributes.subject).- Both values are part of the
scion_v1signature: whatever values you sign in the canonical string must match the headers sent on the request (leave bothEVENT=""andSUBJECT=""empty as above unless you intentionally route on them).
Routing hints
Section titled “Routing hints”Any webhook endpoint can configure RFC 6901 JSON pointers (up to 128 bytes, max 32 segments) to extract routing fields from the verified JSON body:
--type-path(routingHints.typePath) — setsevent.typetowebhook.<value>when the value matches^[a-z0-9_]+(\.[a-z0-9_]+)*$(no case conversion; non-conforming values fall back towebhook.receivedand record a content-freeattributes.routing_hint_error).--subject-path(routingHints.subjectPath) — setsevent.subject.--dedup-path(routingHints.dedupPath) — sets the delivery deduplication key.
Values must be JSON strings or numbers. On scion_v1 endpoints, signed X-Scion-* headers always take precedence over routing hints. On overflow bodies (> 64 KiB), routing hints are extracted from the first 64 KiB only. Note that duplicate JSON keys resolve first-wins.
Updating, disabling, and rotating secrets
Section titled “Updating, disabling, and rotating secrets”Project owners and admins (and agents on endpoints they own) can update endpoints, temporarily disable ingress, or rotate secrets:
# Disable ingress (incoming POSTs return 404; already-queued events still process)scion trigger webhook disable deploysscion trigger webhook enable deploys
# Update configurationscion trigger webhook update deploys --max-body 512KiB --replay-window 120
# Rotate the HMAC signing secret (24-hour grace window for the previous version)scion trigger webhook rotate-secret deploysrotate-secret prints the new secret once and keeps the previous version valid for 24 hours so senders can switch over without downtime. Rotating a second time within 24 hours immediately retires the oldest version.
Agent-Bound Endpoints and Lifetime
Section titled “Agent-Bound Endpoints and Lifetime”A webhook endpoint is always project-owned, but it can be bound to a specific agent with a lifetime (agent or persistent):
-
--to-self(inside an agent container): atomically creates a webhook endpoint bound to the calling agent with lifetimeagentand a defaultmessagetrigger targeting itself (Webhook event received.by default when--messageis omitted):Terminal window scion trigger webhook create --name ci-callbacks --to-self -
--bind <agent>(user callers): binds an endpoint to an existing agent in the project. Add--persistentto keep the endpoint alive after the agent is deleted.
| Lifetime | Flag | What happens when the bound agent is deleted (including soft delete) |
|---|---|---|
agent (default for --to-self / --bind) |
(default) | The endpoint, its secret rows, and any triggers on it authored by the deleted agent are deleted. Triggers on it authored by other principals are paused (status_reason: source_deleted). |
persistent |
--persistent |
The endpoint is unbound (bound_agent_id cleared); its URL, secret, and owner stay intact. Triggers targeting the deleted agent pause with status_reason: target_deleted and can be re-targeted via scion trigger update. |
Restoring a soft-deleted agent does not restore a deleted agent-lifetime endpoint or automatically rebind a persistent endpoint. A bound agent can read its endpoint and that endpoint’s events (scion trigger event list/get), and can disable, enable, rotate, or delete endpoints it owns. Each agent may have at most 5 bound endpoints (counting toward the project’s 20-endpoint cap).
Match Rules
Section titled “Match Rules”A trigger filters incoming events in two stages:
- Event type prefilter (
--type) — repeatable glob/literal patterns againstevent.type(defaults towebhook.receivedfor--webhooktriggers; required for--githubtriggers). - Ordered match list (
--where/--where-file) — an optional ordered list of 1–8 rule elements (match.rules), each up to 4,096 bytes (16 KiB encoded list total).
Ordered mixed-dialect where list
Section titled “Ordered mixed-dialect where list”Each --where flag accepts [<dialect>:]<expr> (default dialect cel). A <dialect>: prefix is recognized only for registered dialect names (cel, system_one); any other prefix is treated as part of a CEL expression. You can also pass --where-file <path> containing a JSON array of {"dialect": "...", "expr": "..."} objects.
Rules are logically AND’d strictly in author order with short-circuit evaluation:
- Put cheap deterministic CEL guards first so inexpensive checks filter out non-matching events before heavier predicates run.
- A rule element that evaluates to
falsestops evaluation immediately as a silent non-match (no fire row is recorded). - A rule element that evaluates to
Uncertain,Failed, fails re-compilation, or runs out of the shared per-event evaluation or compile budget (1 second across all candidate triggers and elements of an event) stops evaluation and records askippedfire with a distinguishable reason (rule uncertain,rule evaluation failed,rule budget exhausted,rule no longer compiles, orrule compile budget exhausted).UncertainandFailednever match. - Every recorded fire includes
matched_through(n/N) anddecided_dialectinscion trigger history(pass--verbosefor the content-free per-element trace). - Admitted dialects:
celis admitted for thetriggerconsumer. Model-backed dialects such assystem_oneare refused at authoring (dialect_not_allowed) unless explicitly granted for the trigger consumer and allow-listed for the project.
CEL environment
Section titled “CEL environment”CEL expressions are compiled at authoring time against:
| Variable | Type / Notes |
|---|---|
event.id, event.type, event.subject |
strings (for webhook events, event.subject is stored prefixed as webhook:<endpoint-id>/<subject>; the raw header/hint value is in event.attributes.subject) |
event.source.kind, event.source.id |
strings |
event.occurred_at, event.received_at |
timestamps |
event.attributes |
map<string, string> (webhook keys including endpoint_name, event, delivery, subject, signature_mode, content_type, payload_bytes, remote_ip, routing_hint_error, payload_ref, and sender for hub_token) |
event.lists |
map<string, list<string>> (used by GitHub App triggers, e.g. event.lists.labels) |
event.payload |
dynamic JSON map/value (inline bodies ≤ 64 KiB only; has(event.payload) is false for overflow bodies) |
trigger.id, trigger.name, trigger.project_id |
strings |
Guard optional fields with has(...) (for example has(event.payload) && has(event.payload.env) && event.payload.env == "prod") so absent keys evaluate cleanly instead of skipping as missing_input. matches() accepts literal RE2 patterns only; run it on event.attributes.<k> or a single event.payload.<field>, not the entire payload.
System One elements
Section titled “System One elements”When the hub.system_one experiment is enabled and the project has allowlisted at least one System One provider instance (scion project system-one add <name>), human project members can include system_one rule elements alongside CEL guards in match.rules. Agent callers are refused at authoring (agent_not_allowed), and the authoring user’s recorded authority is checked before any model egress (revoked, de-roled, removed, or deleted authors record a refused fire with zero provider calls).
A system_one element selects inputs strictly from the trigger content environment v1 (32 KiB combined total; on_oversize: reject; payload_paths supports up to 8 dotted paths on event.payload, for example pull_request.title):
| Input field | Kind | Max bytes | Trust grade | Notes |
|---|---|---|---|---|
event.type |
text |
128 B | untrusted |
Event type string (for example webhook.received) |
event.source_kind |
text |
32 B | trusted |
Hub-set source kind (webhook, github) |
event.subject |
text |
256 B | untrusted |
Event subject string |
event.attributes |
json |
8,192 B | untrusted |
Flat transport metadata map; includes the hub-set client IP (remote_ip) and sender metadata (for example sender: agent:<id> on hub_token endpoints). When this field is selected, these values are sent to the external model provider. |
event.payload |
json |
24,576 B | untrusted |
Inline JSON payload (use payload_paths to send only the needed subtrees) |
- Evaluation budget: Events whose matching candidate triggers include at least one
system_oneelement receive a +2 s System One allowance on top of the 1 s base per-event rule budget (3 s total; capped at +5 s, with a Hub-configurable setting deferred). CEL-only events keep the 1 s budget.
Concurrency subjects and subject claims
Section titled “Concurrency subjects and subject claims”Every event carries a subject (from X-Scion-Subject, --subject-path, or derived via a scalar CEL --subject expression up to 1,024 bytes, producing a non-empty printable string up to 256 bytes). --on-subject controls how concurrent work on the same subject is handled:
new(default) — fire every matching event independently.skip— formessagetriggers, skip while another fire for(trigger, action_index, subject)is currentlyfiring. Fordispatch_agenttriggers, acquire a durable subject claim (trigger_subject_claims) tied to the live dispatched agent; subsequent events for the same subject are recorded asskipped(subject busy) until that agent is deleted or reaches a terminal phase (stopped,error, orhalted). Forexectriggers, hold the claim until the command run finishes.reuse— (GitHub/Stage 3 workflows) reuse an existing live agent holding the subject claim instead of dispatching a new one.
Actions
Section titled “Actions”A trigger runs 1 to 8 ordered actions (actions[], encoded list ≤ 64 KiB). The Hub evaluates the trigger’s match rules and derives its subject once per event, then executes each action in list order with its own fire row (event_id, trigger_id, action_index), its own authority check under the trigger’s recorded authority, and its own subject claim (trigger_id, action_index, subject).
- Failure isolation: one action’s
failed,refused, orskippedoutcome never stops its sibling actions from running. - Rate limits & counters: the per-trigger
--max-per-minutelimit counts matched events, not individual actions. On synchronous paths,fire_countanderror_countaggregate per matched event; on asynchronous paths (detachedexecruns, offline-queue retries/skips, coalesce supersedes, and reaper passes), counters are recorded per action row.
In the CLI, repeat --action <type> and group each action’s flags immediately after it:
scion trigger create --name deploy-pipeline --webhook deploys --type webhook.deploy.failed \ --action dispatch-agent --template investigator --task 'Investigate ${event.payload.service}' \ --action message --agent lead --message 'Deploy failed for ${event.payload.service}' --offline queuemessage action and the offline queue
Section titled “message action and the offline queue”Delivers a structured event envelope (type: "event", event.type: "webhook.received" or webhook.<name>) to a live target agent:
scion trigger create --name ci-alerts --webhook deploys \ --action message --agent lead \ --message 'Deploy ${event.payload.status} for ${event.payload.service}' \ --wake --offline queue --queue-ttl 24h- Message templating:
--messagesupports the${<path>}/${<path>?}placeholder grammar described below. When untrusted placeholders are expanded, the delivered envelope includesevent.templated_varslisting the untrusted paths only (never values). Passing--plain(no envelope framing) together with untrusted placeholders is refused (400 plain_with_untrusted). - Offline queuing (
--offline queue): by default (--offline skip), a fire targeting a non-running agent isskipped(except that an agent suspended by the Hub via idle-suspend is auto-woken automatically without--wakeor the wake permission, and--wakeattempts to resume other suspended targets first). With--offline queue, if the target is insuspended,stopped,provisioning,starting,created, orstoppingphase, the fire enterswaitingand is retried with exponential backoff (30 s → 5 min cap) up to--queue-ttl(default24h, range60s–48h). When the target transitions intorunning, the Hub nudges its waiting fires for prompt delivery.- Every retry re-runs full recorded-authority, standing, and live authorization checks. If the trigger is paused, deleted, or edited (
authorization_revisionchanged), the waiting fire finishesskipped(trigger changed). - If the target enters
errororhalted, or is deleted, the waiting fire finishesskipped. - If
--queue-ttlelapses before delivery, the fire finishesexpired(offline queue expired), which counts as a trigger error and triggers failure notifications. - If the Hub shuts down while a wake attempt is in progress, the fire is reaped as
failed(equivalent to Stage 1; it is never silently re-delivered twice). - Queue caps: 100 waiting fires per target agent and 1,000 per project (
skippedwithoffline queue fullabove either cap).
- Every retry re-runs full recorded-authority, standing, and live authorization checks. If the trigger is paused, deleted, or edited (
dispatch_agent action
Section titled “dispatch_agent action”Creates and starts a new agent from a template whenever an event matches:
scion trigger create --name triage-pr --webhook ci-hooks --type webhook.build.failed \ --action dispatch-agent \ --template triage \ --agent-name 'triage-${event.payload.run_id}' \ --branch 'fix/${event.payload.branch}' \ --task 'Investigate failed build ${event.payload.run_id}: ${event.payload.summary?}' \ --label 'service=${event.payload.service}' \ --max-concurrent 5- Identity & role: dispatched agents are owned by the trigger’s recorded author, with credentials enabled and role chosen from the project/Hub default ladder (capped by project max and the author’s delegation ceiling), or set explicitly via
--agent-role. - Agent name & collisions:
--agent-nameis optional; when omitted, the Hub generates<trigger-name>-<6 base32>. If a live agent already holds the slug,--on-name-conflict suffix(default) appends-<4 hex>(up to 3 retries; if all retries collide, the fire finishesfailedwith reasonname exhausted), whileskiprecordsskipped(agent name in use). Soft-deleted names are reusable. - GitHub token precedence (
--github-token): choosesinstallation(suppress user/project GitHub PATs and inject only the project’s GitHub App installation token) oruser_preferred(standard precedence). Defaults toinstallationforgithubsources anduser_preferredfor webhook sources, resolved and stored at authoring time.- When
installationis active and no GitHub App installation is available for the project, the agent receives no GitHub token and its task trailer notes that GitHub access is unavailable. That note keys on whether a mint project resolves (not on whether a later token mint succeeds, such as a revoked installation)—the agent still never receives a PAT. - Note:
GH_{OWNER}custom secrets or Copilot sign-in material stored outside standardGITHUB_TOKEN/GH_TOKENkeys are not automatically classified as GitHub PATs; keep user-scoped GitHub credentials out of projects where untrusted event-driven agents run.
- When
- Replay protection and delivery ID required:
dispatch_agenttriggers may only attach to replay-protected sources (scion_v1,stripe_v1,hub_token, orgithubApp). Attaching togithub_v1is refused at authoring (400 source_not_replay_protected), switching an endpoint’s mode while such triggers are active is refused (409), and events ingested under a non-replay-protected mode are refused at fire time. Onscion_v1andstripe_v1endpoints, senders must also include a unique delivery ID (X-Scion-Deliveryor--dedup-pathvalue); events without a delivery ID are refused at fire time (missing delivery id). - Ephemeral flag (
--ephemeral): currently refused by the Hub (400 ephemeral_unsupported) until ephemeral trigger-agent reaping lands.
Event context injected into dispatched agents
Section titled “Event context injected into dispatched agents”Every agent started by a dispatch_agent trigger receives:
- Labels (hub-applied, reserved):
trigger=<trigger-id>,trigger_event=<event-id>,trigger_source=<source-kind>(3 of the 16-label max). Authoring refuses these three provenance keys andscion.dev/github-token-source-project(four reserved keys total) as custom--labelinputs. Find sibling agents withscion list --label trigger=<trigger-id>. - Environment variables:
SCION_TRIGGER_ID,SCION_TRIGGER_EVENT_ID, andSCION_TRIGGER_EVENT_FILE(the resolved path to~/.scion/trigger-event.json). - Home file (
~/.scion/trigger-event.json): written by the Runtime Broker before the harness starts, containing the sameEventBodyJSON as a message envelope (event_id,event_type,source,trigger,fire_id,subject,attributes,external_payloadbounded to 16 KiB withtruncated/bytes). Works for every agent role includingnone. If the Runtime Broker does not advertise home-file support, the fire fails rather than starting the agent without its event file. AResetHomereprovision drops this file. - Event read access: the created agent can fetch its own event (including overflow payloads) with
scion trigger event get "$SCION_TRIGGER_EVENT_ID" --payloadwhen its role allows API calls.
Template grammar, trust, and scion trigger render
Section titled “Template grammar, trust, and scion trigger render”Templates are plain UTF-8 text with ${<path>} (required—missing value refuses the fire) and ${<path>?} (optional—missing value renders empty). Escape a literal ${ as $${. Expanded values are never re-scanned, and there are no expressions or filters inside placeholders. Max 64 placeholders per slot.
| Path prefix | Trust class | Notes |
|---|---|---|
event.id, event.source.kind, event.source.id, event.source.name, event.received_at |
Trusted | Hub-assigned |
trigger.id, trigger.name, project.id, project.name |
Trusted | Authoring / Hub metadata |
result.agent_id, result.agent_name, result.agent_url, result.fire_id |
Trusted (post-fire only) | Only valid in post-fire slots such as --ack-comment |
event.type, event.subject, event.occurred_at |
Untrusted | Sender-controlled |
event.attributes.<key> |
Untrusted | String attribute |
event.payload.<path> |
Untrusted | JSON scalar (string, number, boolean) for inline bodies ≤ 64 KiB; null/objects/arrays refuse the fire. Use the canonical bracket form event.payload.items[0] (not items.[0]) so --allow exact matches work consistently. |
| Slot | Max bytes | Untrusted value rules | Framing |
|---|---|---|---|
task |
16,384 (incl. trailer) | Literal UTF-8, no NUL | Appends a Hub-generated Trigger event context trailer listing quoted untrusted values |
message |
16,384 | Literal UTF-8, no NUL | Envelope event.templated_vars lists untrusted paths |
name |
63 | ^[a-z0-9-]{1,32}$; whole name must equal its own slug |
None |
branch |
100 | ^[A-Za-z0-9._/-]{1,64}$, no .., no leading - or .; valid git ref |
None |
label |
63 | Printable ASCII (0x20–0x7E); valid label map |
None |
template, environment variables, secrets, and workspace settings can never be templated. Exceeding a slot’s byte or charset bound refuses the fire (values are never truncated).
-
Untrusted variable list (
--allow/untrustedVars):untrustedVars(exact path or trailing.*) is optional on bothmessageanddispatch_agentactions. When omitted, the Hub derives and stores the list of untrusted placeholders (${event.payload.*},${event.attributes.*},${event.type},${event.subject},${event.occurred_at}) from the templates automatically, and values arrive framed as data. When a list is supplied (including an explicit empty list[]), the Hub checks that every untrusted placeholder is covered ([]with untrusted placeholders is refused) and rejects uncovered paths withuntrusted template variable "<path>" is not allowed in slot "<slot>". In the CLI,--allowis an optional narrowing list, andscion trigger create/updateprintEvent values that will be inserted as data: …per action. In the Web UI, the derived list is shown read-only, labelled Event values inserted as data, not instructions:. -
Dry-run preview: test templates against any stored event without firing or creating resources:
Terminal window scion trigger render triage-pr --event <event-id>
exec action
Section titled “exec action”Runs a command (argv, executed directly via execve with no shell) inside a running target agent’s container over Conduit—no message and no LLM turn. Requires hub.triggers, hub.exec_schedules, and hub.conduit, plus live agent.attach on the target at authoring, resume, and fire time, and a replay-protected source. Currently authored via the Hub API (action.type: "exec" with agentId/agentName, command, timeoutSeconds, and optional contextAttributes).
- No templating in
argv:${is refused incommandat authoring (400 templating_not_allowed_in_argv). - Context via
SCION_TRIGGER_CONTEXT: the Hub passes fixed JSON (event_id,trigger_id,fire_id, plus opt-insubjectand allow-listedattributesviacontextAttributes, ≤ 16 KiB total) in theSCION_TRIGGER_CONTEXTenvironment variable. Requires asciontooladvertisingexec_context.v1. - Argv redaction:
commandis revealed in API/CLI responses only to callers holding liveagent.attachon the target; other readers seecommandRedacted: true,argc, andcommandSha256. Command output is never stored.
Large Payloads (> 64 KiB, up to 1 MiB)
Section titled “Large Payloads (> 64 KiB, up to 1 MiB)”By default, webhook endpoints accept JSON bodies up to 64 KiB, stored inline in trigger_events.payload. You can raise an endpoint’s --max-body up to 1 MiB:
- Bodies ≤ 64 KiB are stored inline and exposed in CEL as
event.payloadand in templates as${event.payload.*}. - Bodies > 64 KiB (up to
max_body_bytes, max 1 MiB) are stored out of line in Hub-private object storage (trigger-events/<project-id>/<event-id>.json, never via public or signed URLs) before the ingress database transaction commits.-
has(event.payload)isfalsein CEL; route on headers, attributes (event.attributes.payload_bytes,payload_ref), and routing hints (extracted from the first 64 KiB). -
Template placeholders under
event.payload.*are treated as out of line (${event.payload.x?}renders empty; required${event.payload.x}refuses the fire). -
Envelopes and
~/.scion/trigger-event.jsoninclude a 16 KiB preview inexternal_payloadwithtruncated: trueandbytes: <N>. -
Fetch the full body through the authorized Hub endpoint (
GET /api/v1/projects/{p}/trigger-events/{id}?payload=1) or CLI:Terminal window scion trigger event get <event-id> --payload --out ./event.json -
Each project has a 256 MiB budget of live overflow objects over the 7-day retention window (above that, ingress returns
429 queue full). Objects are purged with their event rows after 7 days (and an hourly orphan sweep cleans up unreferenced objects older than 5 minutes). -
Ensure any reverse proxy in front of your Hub permits request bodies up to your configured
--max-body.
-
Notify-on-Failure
Section titled “Notify-on-Failure”Triggers can notify a human and/or an in-project agent when a fire fails, is refused, expires in the offline queue, or (optionally) is skipped:
- User notice sink (default on): sends a content-free Hub user notification (
trigger_fire_failed) to the trigger’s creator—or, when the trigger was authored by an agent, to that agent’s delegating user—with the trigger name, outcome, generic reason, and a link to the fire history row. Never contains event payloads orexecargv. A user notice is skipped if the recipient no longer holdstrigger.readon the project. - Agent message sink (optional): delivers a synthetic
trigger.fire_failedmessage to an in-project agent under the trigger’s recorded authority (checked at authoring, update, resume, and every notification; never wakes—including suppressing auto-wake—and never recurses). Recorded as atrigger_firesrow withaction_type: notify(action_index: -1, visible in history; the user-notice cooldown claim usesaction_index: -2and is hidden from history). - Fixed-window cooldown: notifications are rate-limited durably across replicas to at most one notice per
(trigger, sink, outcome, reason)per UTC hour bucket (floor(now / 1h)). Because it is a fixed window rather than a sliding window, two notices for the same key can arrive minutes apart across an hour boundary (for example,10:59and11:01UTC). - At-most-once semantics: the cooldown bucket is claimed before recipient lookup, authorization, or delivery, so a failed or skipped delivery consumes the bucket for the remainder of the hour. A Hub crash between committing the terminal fire outcome and dispatching the notification loses the notice, and fires reaped after a Hub crash (
hub restarted during fire) or cancelled by coalescing do not notify. - Project live-agent cap: breaching the 25-agent per-project trigger cap always routes through notify-on-failure (once per hour bucket per trigger) even when
skippedis not opted in.
Notify-on-failure is configured with the CLI, API, or the web rule editor (scion trigger create / scion trigger update):
--notify-user/--notify-user=false— toggle creator user notices (defaulttrue).--notify-agent <name|id>— optional in-project agent to notify (pass""onupdateto clear).--notify-on failed,refused,expired[,skipped]— comma-separated outcomes that trigger a notification (defaultfailed,refused,expired).
Editing notify settings bumps authorization_revision.
Why Didn’t My Rule Fire?
Section titled “Why Didn’t My Rule Fire?”Webhook events are recorded at ingress even when no trigger matches. Fire history (scion trigger history) shows only rules that matched or recorded a skipped fire (such as rule uncertain, rule evaluation failed, rule budget exhausted, rule no longer compiles, or rule compile budget exhausted); a silent non-match leaves no fire history row (non-matches are not skipped).
To debug why an event did not fire a rule:
- Find the recorded event in the Web UI’s Events tab, with
scion trigger event listandscion trigger event get <event-id>, or viaGET /api/v1/projects/{p}/trigger-events. - Check
event.typeagainst--type: sendingX-Scion-Event: deploysetsevent.typetowebhook.deploy, which a defaultwebhook.receivedrule does not match. - Check
event.subject: for webhook events,event.subjectis stored prefixed aswebhook:<endpoint-id>/<subject>, while the raw header or routing-hint value is inevent.attributes.subject. - Preview template rendering against the stored event with
scion trigger render <trigger-id-or-name> --event <event-id>, or click the Preview render (eye) icon on the rule’s row in the Rules tab, which renders against the latest event received on the trigger’s source.
Visibility into non-matching rule evaluations is tracked in ptone/scion#9780.
Web UI
Section titled “Web UI”When hub.triggers is enabled, each project displays a Triggers button in its header linking to /projects/{id}/triggers with four tabs:
- Endpoints — create endpoints (shows the one-time signing secret and sender example in a result dialog; secrets are never kept in component state), edit settings/bindings, disable/enable, rotate secrets, and delete (listing rules that will pause).
- Rules — create and edit single- or multi-action triggers with an ordered
whererule list editor (add/remove/reorder rows, admitted-dialect selector, per-row compile errors), ordered action editors (showing derived untrusted variables read-only as Event values inserted as data, not instructions:), limits, and notify-on-failure settings (user notice toggle, optional notify agent, and outcomes). Whensystem_oneis admitted for the project, users can add, edit, reorder, and removesystem_onerows inline using the System One spec JSON editor (4,096 B per-element limit, server-authoritative validation) and project instance picker (no provider calls on render, edit, or save); non-admittedsystem_onerows remain read-only and byte-identical, and the form authoring pane is disabled whenever any non-CEL rule is present. Each rule row also offers a Preview render (eye) icon that callsPOST .../renderagainst the latest event received on the trigger’s source with untrusted values highlighted. - Events — browse received events filtered by endpoint, status, or time; inspect attributes, headers,
external_payload(with download for overflow bodies), and resulting fires. - History — project-wide fire history (
GET .../trigger-fires) filtered by trigger, status, or time, linking to the event, created agent, orwaitingdeadline (wait_until); notify agent-sink rows appear asnotification (agent sink)with no event link.
Hub administrators can also inspect durable queue health (durableQueues) on the Admin Scheduler page.
Security Notes
Section titled “Security Notes”- Anyone with
trigger.readcan read event bodies sent to any webhook endpoint in the project. Do not send unencrypted secrets or sensitive personal data in webhook payloads unless every project reader is authorized to see them. - All event content is untrusted data, not instructions. Treat
external_payload, templated values intask(flagged by the lastTrigger event contexttrailer), andtemplated_varsin message envelopes as attacker-influenced input. - Sender-set mutability: An endpoint’s sender set may be widened by authorized endpoint owners/admins (including the owning agent) after triggers are attached (for example, switching to
hub_tokenadmits every project member) without author re-consent. Changes are audited on the endpoint, and authors are not notified. Triggers—including those with System One elements—then evaluate events from the new senders under the author’s recorded authority, with all event content treated as untrusted and only the element’s declared, size-bounded inputs sent to an allow-listed instance. Only the replay-protection rule for agent-creating andexectriggers is enforced across mode changes. execsecurity:SCION_TRIGGER_CONTEXTis untrusted, sender-influenced JSON. Always parse it with a JSON parser (such asjqor Pythonjson) and never expand$SCION_TRIGGER_CONTEXTunquoted in a shell command.- Never put secrets in
execargv:commandSha256andargcare visible to trigger readers withoutagent.attach, so low-entropy secrets inargvcould be guessed offline. Use agent secrets or environment variables instead. - Authenticated vs. unauthenticated attributes: on
scion_v1,event,delivery,subject, and the JSON body are covered by the HMAC signature;endpoint_nameandsignature_modeare Hub-derived;content_typeandremote_ipare NOT covered by the signature. Onstripe_v1, only the timestamptand the raw JSON body are signed (routing-hint values come from the signed body; HTTP headers are unsigned). Ongithub_v1,X-GitHub-Event(event) andX-GitHub-Delivery(delivery) are unsigned headers—only the body is signed. Onhub_token, the caller is authenticated by their Hub credential, but every header is caller-chosen.
- Pre-authentication memory on large-body endpoints: raising
--max-bodyabove the 64 KiB default increases the maximum request body buffered before signature verification (up to 1 MiB per in-flight request, bounded by per-IP and per-endpoint rate limits). Leave--max-bodyat 64 KiB unless your sender requires larger payloads. - Overflow payload stream & timing: overflow payloads are served only through the authorized Hub endpoint (
application/json,X-Content-Type-Options: nosniff,Cache-Control: no-store, never via signed URLs). The 5-minute orphan-sweep grace assumes Hub and object-storage clocks stay within ~4 minutes of each other. The 256 MiB per-project budget window counts rows over the 7-day retention window and can transiently overshoot by up to ~1 hour of ingress while aged rows await the hourly purge. - Agent-mode secrets: running
scion trigger webhook createorrotate-secretinside an agent prints the one-time secret into the agent’s transcript; agent-owned endpoints are isolated so that secret only feeds that agent’s own endpoint.
Limits
Section titled “Limits”| Limit | Default | Maximum / Range | On breach |
|---|---|---|---|
| Webhook endpoints per project | — | 20 | 409 |
| Bound endpoints per agent | — | 5 | 409 |
| Triggers per project | — | 200 | 409 |
| Active triggers per source | — | 50 | 409 |
Match rules (where) per trigger |
— | 8 rules (4,096 B each; 16 KiB total) | 400 |
| Actions per trigger | 1 | 8 actions (64 KiB encoded total) | 400 |
| Per-endpoint ingress rate / burst | 10 req/s / 60 | ≤ Hub defaults (can lower, not raise) | 429 Retry-After |
| Per-IP ingress rate / burst | 20 req/s / 100 | Hub constant | 429 |
Per-endpoint body size (--max-body) |
64 KiB | 1 MiB (> 64 KiB stored out of line) | 413 |
| Overflow storage per project (7 d) | — | 256 MiB | 429 queue full |
Replay window (--replay-window) |
300 s | 30 s – 900 s | 401 |
| Secret rotation grace window | 24 h | Fixed | 401 after grace |
Per-trigger fire rate (--max-per-minute) |
Unlimited (0) |
600 / min (counts matched events) | skipped (rate limit) |
Per-trigger dispatch concurrency (--max-concurrent) |
5 | 50 live agents | skipped (concurrency limit) |
| Per-project live trigger-created agents | 25 | Hub constant | skipped (project trigger-agent cap) |
| Offline queue per target / per project | — | 100 / 1,000 waiting fires | skipped (offline queue full) |
Offline queue TTL (--queue-ttl) |
24 h | 60 s – 48 h | expired |
| Event and fire history retention | 7 days | Hub constant | Purged hourly |
CLI Reference
Section titled “CLI Reference”See scion trigger in the CLI Reference for the complete list of subcommands and flags.