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

Rules: CEL, the dialect seam and System One

ptone chose CEL as the rule engine (D4), with friendlier forms and GitHub presets layered on top that compile down to CEL. Later the same day (2026-11-14) he widened it to “one rule engine, two dialects”: CEL first, and a model-backed System One dialect owned by the System One workstream. Triggers owns the seam; System One owns its dialect.

Consumers pkg/triggerrule (Triggers)trigger environment, kinds filter → bool andsubject → string; errors → “skipped” message_policy (System One M1)CEL-only message admission/routing policy,shadow mode first (in progress, ptone/scion#8047) future consumersthe engine is consumer-neutral by design pkg/ruleengine: dialect registry (one engine per hub, built in NewServer) common Decision / UncertainError / FailedError types · per-consumer grants, deny by default (GoogleCloudPlatform/scion#4945) I/O dialects need an explicit AllowIO grant · experiments enforced at use · rule slots tagged {dialect, expr}, default cel dialect “cel” → pkg/celengine only importer of cel-go · standard library + string extensions no I/O, no custom functions · typed environments, program cache cost limit, size cap, 100 ms timeout, recursion depth 32 regex: literal patterns only · embedded tzdata only merged upstream: GoogleCloudPlatform/scion#4913 dialect “system_one” → pkg/systemone model-backed: a configured decision model answers typed questions (boolean or closed choice) · performs bounded I/O provider adapters, SSRF-safe egress, deadlines, retries, circuit breaker, cache · experiment hub.system_one registered upstream: GoogleCloudPlatform/scion#4942
One engine, two dialects. Consumers compose dialects in Go; there is no model-to-CEL translation and model I/O never runs inside CEL. The system_one dialect is registered, but no trigger can use it yet: Stage 1 accepts only cel in rule slots.

How a trigger rule is evaluated

  1. Event types (required, 1–16 entries, exact or prefix.*). A rule cannot match “everything”. Candidates are loaded per (project, source) and filtered by type.
  2. Match rules (optional; since 2026-11-17 an ordered list of 1–8 elements, each {dialect, expr}, ≤ 4 KiB each, ≤ 16 KiB in total). Elements are evaluated in the author’s order and AND’d, stopping at the first that does not match; the fire records how far it got (matched_through). Each element is compiled at authoring with positioned errors and cached per revision; a single rule is a list of one. Empty means “all events of those types”. CLI: repeatable --where [dialect:]expr or --where-file. Built in 3b-1 (ptone/scion#8234, scope ptone/scion#8257); design mixed-rule-arrays-design.md.
  3. Subject rule (optional CEL, ≤ 1 KiB) overrides the source’s subject. Bad output falls back to the event subject.

The CEL environment: event.id, event.type, event.source.kind/id, event.subject, event.occurred_at, event.received_at, event.attributes (flat strings), event.payload (the bounded JSON body), trigger.id/name/project_id; Stage 3 adds event.lists (labels, assignees…). Example GitHub preset output:

event.attributes.command == 'review' && event.attributes.is_pull_request == 'true' && event.attributes.sender_type != 'Bot'

Failures are never turned into “no match”: an evaluation error records the fire as skipped "rule evaluation failed", and each event has a 1 s total CEL budget across its candidate rules.

Sources differ: the plan (§3.7) describes Types as an indexed SQL prefilter. The Stage 1 design (§7.3) deliberately filters types in Go after the per-source SQL query (at most 50 candidates). The plan relied on RE2 semantics for regex safety; after code review found repeated limit escapes through regex, ptone chose literal-only regex patterns (option A, 2026-11-15). One table row in the Stage 1 design (§7.2) still mentions sender-supplied patterns.

System One as a second dialect

System One provides fast, model-backed semantic decisions for message admission and routing, trigger filters and routes, and later features. Its first provider is TypeSafe. For triggers, the seam sets these constraints on any non-CEL dialect (Stage 1 design §7.0a, plan §3.7 amendment):

Shared by CEL, Triggers and System OneSystem One only
  • pkg/ruleengine registry and one per-hub engine
  • Decision and error types (uncertain vs failed)
  • Deny-by-default consumer grants, AllowIO opt-in
  • Dialect-tagged rule slots
  • Durable queue; trigger outcome policy (both errors → skipped)
  • Provider adapters and SSRF-safe egress
  • Instance configuration (system_one_instances)
  • Deadlines, retries, circuit breaker, cache, capacity admission
  • Portable and native specs; thresholds
  • hub.system_one experiment

Two meanings of “admission”: dialect admission (merged, GoogleCloudPlatform/scion#4945) decides which consumer may use which dialect; System One’s runtime admission is capacity control (semaphores and a token bucket) inside the dialect.

Trigger track of System One: T1 a CEL route slot; T2 semantic trigger filters (ptone/scion#8051, prerequisite P2 ptone/scion#8045); T3 a System One route. Since 2026-11-17, T2 is a system_one element inside the ordered rule list (typically after cheap CEL guards). ptone’s v1 defaults (18:00Z): the per-project instance allow-list is empty everywhere, with explicit opt-in; only users, not agents, may author System One elements. Which project and author may use which instance, and what content may leave the hub, is still design work owned by system-one-mode. Nothing of T1–T3 is built yet.

Status: several System One design documents (provider, runtime, consumer) describe themselves as not yet approved by ptone, and the defaults for uncertain versus failed outcomes are an open product decision. For triggers this is settled by the rule-list design: either outcome stops the list and records the fire as skipped with the deciding element.