ADR-168 — An event source is a connector package: a pinned verification contract, a sanitized event, a durable intake, and a subscription that maps the event onto a bot's vars
- Status: Accepted — the operator decided it on 2026-11-14. Direction: native connector packages rather than an app aggregator at runtime; a first wave of Slack, Mattermost, Jira, Linear, Sentry, Alertmanager and polled RSS/Atom and Jira; delivery to a bot's parked run in scope, its semantics left to #3135, where the operator chose a standing bot as an address over rotating runs. After two rounds of plan review by codex gpt-6-astra (xhigh), 22 findings each with dispositions at the end, the operator accepted the record's four departures from the approved plan:
boardrefused on connector subscriptions; polling promising the revisions it observes; one Slack app per connection; Linear's setup manual. - Date: 2026-11-14
- Amended: 2026-11-14, by the intake and pair lot of #3271 — §8.3 and §8.4 state the launch as built: an idempotent submission keyed by (pair, epoch), the epoch a spent run id advances, a completion that is a new queue attempt, replays that never start a second run, and claims any worker reclaims past their expiry, so no elected reconciler is needed. 2026-11-15, by the ingress lot of #3271 — §3 states the lane as built: a binding that cannot vouch refuses before verification, the monthly quota is charged only for a delivery the intake stores, an ingress binds no bot, its pin moves only by explicit consent, and the dedup identity is the signed body alone (a timestamp signed apart made every re-signed vendor retry a second intake). 2026-11-19, by #3396 — §7 states the answer's order:
order: oldest_firstlets a scan that stops before its last page move a timestamp checkpoint, and an opaque cursor requires it. 2026-11-19, by #3396 — §8.2 builds every pair throughintake.PairFor, a polled pair carrying its item's key, and §8.3 does not launch a polled pair whose subscription already holds a launched pair of that revision, so a subscription moved to another query is not delivered a revision twice; pair ids stay (intake, subscription). 2026-11-19, by #3396 — §5 declarestype: listfilters, which match by membership, and a package may shipsetup-poll.md, the notes the studio shows for a polled trigger. - Deciders: jo (direction, the three arbitrations), Claude (the design), codex gpt-6-astra (the plan review)
- Extends: ADR-098 — this is the "trigger ingress family" its
triggers.yamlsection defers to a later lot of #1072: event filters, payload mapping, durable polling cursors and the studio surfaces. ADR-046 — the spine's envelope, subscriptions and evaluator are the binding this record extends. - Relates to: ADR-094 (effects durable before the cursor moves) · ADR-117 (an elected replica per net, which is not mutual exclusion) · ADR-034 (webhook authentication) · ADR-138 (provisioned hook identities and epochs) · ADR-051 and ADR-081 (the parked run an event will reach) · ADR-139 (no code loaded in process)
- Serves: #3269 (the event-source catalog) · #1072 (its P2 inbound half and its P3 polling cursors) · #3133 (standing crews) · the live-agents study
Context
An operator wants to connect event sources — a chat tool, a ticket tracker, a monitor, a feed — and plug one into a bot in one click, from a catalog where each source carries its logo. OpenMausBot offers this by delegating its "connected apps" to Composio, a hosted aggregator that handles the OAuth and relays the events of hundreds of applications.
iterion has the pieces of this and not the whole:
- One inbound lane, one event. ADR-098's connector lane (#2761,
pkg/server/webhooks_connector.go) believes a delivery through a connection'striggergrant and the package's declared events. It is entered from the Forgejo route only, and it parses one payload into a Go struct (forgejoIssueComment) whose fields become hardcoded vars (forgejo_event,issue_number,comment_id…). - Closed sets where the next variant should be data.
trigger.Source(pkg/trigger/event.go),webhooks.Provider(pkg/webhooks/types.go) and the manifest'sinvocations.kind(pkg/bundle/manifest.go, its DTOs andstudio/src/api/triggers.ts) are each a closed list — the smell philosophy §2 names. - Five binding stores. A bot is bound to an event through
webhooks.Config(and itsBotRules),cloudsched.ScheduledBot,trigger.Subscription,schedules.yamloriterion.dispatcher.yaml. The connector lane picks its bot from the webhook config's default, so one webhook launches one bot. The localtrigger.Subscriptionstore is in memory and is rebuilt from manifests with fresh ids at every start (pkg/cli/trigger.go). - Nothing to show.
connector.yamlhas no icon or category, no route lists the packages or their triggers, and the studio types a connector's name as free text. - No filter, mapping or polling.
triggers.yamlcarriesid,eventanddescription; ADR-098 left the rest deferred on purpose, each being a field invented before its reader. - Admission before authentication. On an HMAC-signed webhook, the middleware charged the per-webhook rate bucket and the tenant's durable monthly counter before the provider handler verified the signature, so anyone holding a hook's URL could spend a tenant's quota. #3276 fixes the existing lanes; this record states the rule for the new one.
This record is the reader ADR-098 waited for.
Decision
1. A source plugin is a connector package
The catalog's unit is an ADR-098 package and nothing else: no new artifact kind, no plugin.yaml contribution (ADR-098 refused that manifest's lifecycle and tenancy for connectors). A package that declares triggers is a source, resolved through the same tiers — baked, platform, team, git — under the same maturity rule: a spotted package is listed and inert.
The measure of the seam. Once this record is implemented, adding a source whose wire contract fits the declared vocabulary is files under connectors/<id>/ and no Go. Each package of the first wave is checked for it — an empty git diff --stat outside connectors/, the package's own tests aside. A vendor that needs a new verification scheme, body encoding or response format adds it in Go, argued on its own: those are the vocabulary, not a source.
2. What a package shows: connector.yaml's presentation fields
Optional fields at the package's constant schema version (ADR-098's growth rule):
icon:— a file of the package (icon.svg), sanitized once at load:script,foreignObject, everyon*attribute, every external reference (href/xlink:hrefandurl()outside a#fragment) and anything that is not SVG are removed. A file aboveITERION_CONNECTOR_ICON_MAX_BYTES(64 KiB by default; 0 removes the cap) or that the sanitizer cannot parse fails the package's validation, naming the file.brand_color:— a#rrggbbfor the monogram fallback and the tile's accent, contrast-checked against the surface tokens.category:— an open vocabulary (chat,tickets,monitoring,forge,feeds,calendar, …); an unknown value is a C1xx warning, never a refusal (philosophy §1).homepage:,docs_url:, andprovenance.icon:— where the logo comes from (the vendor's press kit, or simple-icons under CC0). A brand's mark is used nominatively, to name the service.
GET /api/v1/connectors/{id}/icon serves the sanitized bytes as image/svg+xml with Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox, X-Content-Type-Options: nosniff and an ETag equal to their digest. The studio renders a logo as an <img>, never inline: the sanitizer and the image context are two defences, so neither has to be perfect alone. A package with no icon gets a monogram tile.
3. The verification contract: triggers.yaml's ingress: block
A document-level block, optional, at schema_version: 1. Every reader of a delivery for this package reads it, so the lane holds no vendor's name:
ingress:
body: json # json | form — decoded once, under the body cap
credential: # what proves the sender
scheme: hmac-sha256 # hmac-sha256 | hmac-sha1 | token | bearer | basic
in: header # header | body | query
name: X-Forgejo-Signature
encoding: hex # hmac only: hex | base64
prefix: "" # Slack: "v0="
signed: "{body}" # hmac only; Slack: "v0:{timestamp}:{body}"
secret: minted # minted (iterion generates it) | vendor (the operator pastes the vendor's)
timestamp: # optional replay window
in: header # header (Slack) | body (Linear: webhookTimestamp)
name: X-Slack-Request-Timestamp
unit: s # s | ms
tolerance: 5m
installation: 'payload.team_id' # optional: the authenticated identity a delivery must carry (§6)
event: { header: X-Forgejo-Event } # or { from: 'payload.type' }
delivery_id: { header: X-Forgejo-Delivery } # metadata only (see "identity")
headers: [X-Forgejo-Event, X-Forgejo-Delivery] # the only headers an expression may read
redact: [token] # body fields removed from the event
handshake:
when: 'payload.type == "url_verification"'
respond: 'payload.challenge'
ack: { status: 200, body: "" }- Bounded extraction, then verification, then nothing else. The lane reads at most the body cap, decodes it once when a credential, a timestamp or an installation lives in the body, extracts exactly the declared fields — refusing a body where one is missing, repeated or not a scalar — and verifies the signature over the raw bytes and the timestamp within its tolerance. A delivery that fails answers 401, is logged, and changes no durable state: no intake row, no monthly counter, no per-webhook rate bucket. Before verification only a per-source-IP limit applies.
- The signed-string template is validated.
signedmust contain{body}. It must contain{timestamp}exactly when the timestamp is read from a header — a timestamp in the body is already authenticated by{body}, as Linear signs it. A template that drops a required component fails the package's validation. - Identity comes from authenticated material. The intake's dedup identity is the digest of the signed body. A timestamp signed apart from it is not part of it: a vendor re-signs each retry at its own instant — Slack's third retry comes five minutes after the first attempt, past a window that kept the first instant — and a retry must meet the row of the delivery it repeats, not open a second one and launch a second run. The window already refuses an old timestamp, and the body's digest absorbs a replay inside it, so the timestamp adds no replay protection to the identity. A vendor's delivery-id header is unsigned, so it is kept as metadata and never trusted for dedup: changing it on a captured request must not open a second intake. A captured request replayed within the dedup retention is absorbed; a vendor without a signed timestamp gets no stronger replay protection than that, and the setup matrix (§6) says which ones. A vendor that changes the signed body on a retry (Linear's
webhookTimestamplives in the body) is not deduplicated by this identity; a package-declared key over the authenticated body is the follow-up that covers it. - The installation is authenticated, not routed. A vendor whose one endpoint serves several installations (a Slack app's single request URL) declares
installation:, an expression over the authenticated body. Binding records the value the operator's connection belongs to, and a delivery carrying another value is refused. The URL says which ingress was hit; only the signed body says whose event it is. - The consented contract is pinned. Binding an ingress records the digest of the package's
ingress:block as the operator consented to it. A delivery whose package now resolves to a different contract — a team override of a baked package, a new version — is refused with a typed error naming both digests until the operator re-binds. This is the inbound twin of the outbound resolver's refusal of a changed credential placement (pkg/connection/resolve.go). - The secret's origin is declared.
minted: iterion generates the secret, shows it once and gives it to the vendor (or provisions it, §6).vendor: the vendor generates it (a Slack app's signing secret, a Mattermost outgoing webhook's token) and the operator pastes it; the ingress route accepts it on creation and on rotation. It is sealed like every webhook secret, and rotation opens an ADR-138 epoch. - The answer is declared, and admission precedes it. An authenticated delivery is admitted against the tenant's quota and against a per-tenant cap on unprocessed intake (
ITERION_CONNECTOR_INTAKE_BACKLOG_MAX, 0 removes it): over the cap it answers 503 so the vendor retries later. Admitted, it is answered with the package'sack(200 and an empty body by default) as soon as its intake row is durable (§8), never after matching: a vendor's deadline (Slack's three seconds) does not wait for a run to start, and a vendor that reads any other status as a failure (Linear) gets exactly what it expects. - As built (
pkg/server/webhooks_ingress.go). Verification needs the pinned contract, so the binding is resolved first: a connection that is gone, names another connector, lacks thetriggergrant or is not live, and a contract that changed, answer 409 before verification and write nothing; a store that cannot answer is 503. Before the proof nothing decodes the body into a tree: a credential or a timestamp that lives in the body is read by a top-level scan, and the per-source-IP limit is keyed by the resolved ingress as well, since a vendor delivers every tenant's hooks from one shared pool — after the ingress is read, so an id a sender invents creates no limiter state. A handshake is answered before the installation is checked — Slack's endpoint verification carries none — and the installation is read from the signed body only. The quota is the one admission step that writes, so it runs last and counts what the intake stores: a handshake, a filtered delivery and a redelivery that meets its row are answered without it, the backlog cap is read before it (a soft bound under concurrency), and a write that meets a twin's row, or fails with its row proven absent, gives its unit back. An ingress binds no bot — a subscription does (§6) — so the webhook's bot scope is refused on it. The pin moves only by explicit consent: a PATCH restating thecontract_digestthe package resolves to, a re-bind or an echoed row moving nothing; the ingress records its connector and its secret's origin, so it keeps its vendor when its connection is gone, and a contract that changes the origin needs a rotation first.
4. The sanitized event
What an expression, a preview, the intake store, the bus and a launched run see is the event, never the request: event.<output> (the declared outputs, §5), event.payload (the decoded body without the redact fields and the credential field) and event.headers (only the headers listed in headers:; Authorization, Cookie and the credential header are never listable). The raw body and the full headers exist only inside verification and dedup, and are never persisted, logged, published or passed on. An event's text reaches a prompt as untrusted input, in the same class as a forge comment today.
5. What a trigger declares
Per trigger, every field optional beside ADR-098's id, event and description:
display_name:— the catalog's label.delivery: webhook | poll—webhookby default.outputs:—{ name, from: <expr>, description, type: string | int | bool | list | map }, what the studio offers for mapping and what a run receives by default. Reserved names, each with a fixed type, fill thetrigger.Eventenvelope and the launch:subject,subject_state,actor,repo,thread(strings),labels(list of strings), andrepo_url,repo_ref(strings), which become the launch's clone target. Arepo_urlis believed only when its host is the connection's base URL host or is in the ingress's repository allowlist; otherwise the delivery is refused, naming the host.threadkeys the conversation a delivery belongs to (a Slackchannelandthread_ts, a Mattermostroot_id, an issue key), which thedelivermode reads.filters:—{ id, from: <expr>, type: string | enum | bool | list, options, default, selector }, predicates over the event. A subscription stores the chosen values; astring,enumorboolfilter matches when the event's value is one of them, alistfilter when any element of the event's list is, each value converted as a launch converts it (§9). The type is declared so the studio picks its input before any event exists, and the sample proves it at load: where it carries the value, alistfilter reads a list. A scalar filter over a list compares the list's JSON text;type: listis the membership reading.selector:names an operation of the same package whose result fills a picker.ignore:— an expression that drops an event before matching: the loop guard (a bot's own Slack message), stated by the package because only the package knows the vendor's markers.sample:— a file undersamples/, a real delivery with its secrets removed, which the preview and the package's tests read.provision:— §6.poll:— §7.
6. The binding is a trigger.Subscription
No sixth store. The ingress and the binding are split along what each owns.
The ingress is a webhooks.Config with Provider: connector, the last value of the closed provider set; the vendor is read from the connection, the route is POST /api/webhooks/c/{ingress_id}. An ingress is one per (connection, registration scope): a Forgejo connection that serves three repositories has three ingresses, each with its own hook and secret, because Forgejo registers hooks per repository (pkg/forge/admin.go). An ingress holds the sealed secret and its origin, the pinned contract digest, the bound installation value, the operator's allowlists and hold-label veto, and its provisioning state.
The binding is a trigger.Subscription:
The event carries where it came from.
trigger.EventgainsConnectionIDandIngressID(orPollerID), set by the server, never read from a payload. A connector subscription stores a scalarconnector_key(<connection id>/<trigger id>), andListCandidatesfilters on tenant, enabled andconnector_keyover a Mongo index on those three scalar fields — two array fields cannot share one compound index — so two connections to one vendor never fire each other's bots.trigger.SourceConnectoris the last constant of the closed source set: what follows isKind, the trigger id, which is data.One discriminator, refused where it is unsupported. The existing
Modestays the only field that says what a match does, and gainsdeliver. Every constructor and dispatcher that reads it — theFrom*Invocationbuilders (which today forcedirectfor schedule and keepalive, and default board invocations toboard),EffectiveMode, the evaluator, the forge dispatch — refuses a kind and mode it cannot honour, with a typedunsupportedresult, before any subscription is built; nothing defaults an unknown mode to a launch.deliverstays refused until #3136 ships it.boardis refused on a connector subscription: the board effect promotes an existing native card (pkg/server/trigger_cloud.go), and turning an external event into a card is a contract of its own.The rest of the binding:
filters(chosen values, plus an optionalwhen:expression),var_map(a var name to an expression over the event), for a polled trigger thepollerit listens to (§7), andno_live_run: launch | drop, stored now and read by #3136. With novar_map, each output named like a declared var of the bot is passed under that name. Saving a subscription validates the map against the bot's declared vars (botregistry.EntryWithSchema.Vars) and answers 400 on an undeclared target or an unfilled required var.Durable everywhere, bootstrapped idempotently. The local subscription store becomes persistent under the run store (
.iterion/), beside the Mongo store and a memory store kept for tests; intake, pairs and poll state follow the same three-way rule. Manifest-derived subscriptions get stable ids (from bot, kind, trigger and connection) and are reconciled, not regenerated: an operator's disable or delete leaves a tombstone the next start honours. The workers start from durable state whether or not the manifest scan finds anything.The manifest suggests, the operator binds.
invocationsacceptskind: connectorwith{ trigger, mode, filters, vars }. A manifest-derived subscription's identity is (bot, kind, trigger id, connection), so a bot written for Slack and Jira gets two; thefrom-invocationroute gains a connector builder and stops refusing a second subscription of one kind. Every consumer of the kind enumeration — manifest validation, the registry DTOs, the studio types — accepts it. The.bottext gains nothing (ADR-046).As built (L1d).
bundle.ResolveModeis the one reading of a mode: theFrom*Invocationbuilders, the evaluator and the effect worker, forge provisioning (rules, command map, cloud schedules), command discovery, the webhook dispatch, the fork gesture, the trigger routes and the lint (C215) refusedeliver, an unknown mode andboardon a connector, typed.ConnectorKeyis derived by every store write; the candidate query for a connector event selects tenant, enabled, key and poller over thetenant_enabled_connector_keyindex, sorted by id, and every other source's query excludes keyed rows, the evaluator refusing any keyed or connector-kind row a store hands it. The local store is a file journal (<store>/dispatcher/trigger-subscriptions.json, the row version kept for the CAS) reconciled at each start: it refreshes what a manifest owns, keeps the operator's enabled flag, pins and guard, and removes a derived row only when its bot was discovered and its invocation is gone, without a tombstone; a connector row is never derived, refreshed or removed there. Tombstones live intrigger_subscription_tombstonesin cloud; a Mongo insert re-reads the tombstone after it lands, so a racing delete wins. A connector subscription is judged at save (binding.ValidateSubscription) against its connection (tenant, connector,triggergrant), the package's trigger and filters, the bot's declared vars and required ones; an edit that changes none of the binding is not judged again, so a subscription whose connection is gone stays pausable. The local scope's connections and intakes live under the tenantlocal, its subscriptions under""(binding.SubscriptionTenant/ConnectionTenant). The routes ship under/api/v1/on the request's team; the/api/teams/{id}/…family follows.
The routes the wizard needs, team-scoped in cloud; locally the same handlers under /api/v1/ on the local tenant, as /api/v1/triggers already is, because a local process has no team (pkg/server/server_routes.go):
| Route | What it does |
|---|---|
GET …/sources | the catalog (§10) |
POST …/connections | a connection; accepts auth kind: none and basic, and the trigger + action grants |
POST …/connections/{cid}/selectors/{filter} | runs a filter's selector operation through the resolver |
POST …/ingresses | an ingress for a connection and a registration scope; mints a secret or accepts the vendor's |
POST …/ingresses/{iid}/provision · DELETE … | the provisioning lifecycle below |
GET/POST/PATCH/DELETE …/triggers* | subscriptions |
POST …/triggers/preview | the filter verdict and the vars a run would receive, against a pasted payload or the sample; launches nothing |
GET …/intakes?state=dead · POST …/intakes/{id}/replay | the dead-letter view and replay (§8) |
Provisioning follows ADR-138's discipline. A package that provisions declares create, delete and list operations, a match: expression that recognises its own hook in a list result, and id_from:. Their params see a registration context: the ingress URL and secret, the epoch, a marker unique to the epoch, the scope, and on delete the remote hook id. The ingress records the desired state, the epoch, the remote id once known, and the cleanup owed by a retired epoch. A create whose response is lost is resolved by list: one match is adopted; none means the create may still land, so the epoch stays pending and the reconciler lists again before it creates; several are an error naming the remote ids. A late create of a retired epoch is deleted by its cleanup obligation. A package without list cannot provision: its setup is manual.
Which first-wave source is one click:
| Source | Credential | Replay protection | Hook setup |
|---|---|---|---|
| Forgejo | HMAC header, minted | body digest | provisioned per repository |
| Jira | HMAC header (X-Hub-Signature), minted | body digest | provisioned through the webhook REST API |
| Slack | HMAC with header timestamp, vendor | timestamp window + digest | manual (setup.md): one app per connection, its team_id/api_app_id bound as the installation |
| Mattermost | token in the body, vendor | body digest | manual in the first wave |
| Linear | HMAC header, body timestamp in ms, minted | timestamp window + digest | manual in the first wave: its hook API is GraphQL, which the executor does not speak yet |
| Sentry | HMAC header, vendor | body digest | manual (setup.md) |
| Alertmanager | bearer or basic, minted | body digest | manual (setup.md) |
| RSS/Atom, Jira JQL | none, or the connection's | — | polling |
7. Polling
A trigger with delivery: poll declares a query and how to read it:
poll:
operation: jira.search.issues # paginated by the operation's own contract
params: { jql: 'concat(query.jql, " AND updated >= \"", cursor.value, "\" ORDER BY updated ASC")' }
query: [ { id: jql, type: string } ] # what an operator writes; part of the poller's identity
items: 'response.issues'
item_id: 'item.key'
item_version: 'item.fields.updated'
cursor: { from: 'item.fields.updated', kind: timestamp, overlap: 1m }
order: oldest_first # the answer's order; a cut scan still moves a timestamp checkpoint
interval: { default: 5m, min: 1m }A poller is a query. Its identity is (tenant, connection, trigger, the digest of its
queryvalues). A subscription to a polled trigger names its poller, and an intake from a poller is matched only against that poller's subscriptions — two overlapping queries never deliver one item twice to one subscription.queryvalues shape the request;filtersstay predicates over each item.Pages follow the operation's contract. The scan uses the operation's declared pagination (
CursorParam/PageParam,pkg/connector/spec/package.go) throughexec.CallPaged. A scan that ends incomplete — a page error, a repeated token,complete=false— keeps what it accepted, does not prime, and records why for the next tick.order: oldest_first, the one order a poll declares, says the operation answers oldest first: the pages a cut scan read are then the oldest of the answer, so every instant before the last one it read is read in full, and on a timestamp cursor the scan moves the checkpoint to the latest of those — never back, never past the tick's clock — and the next tick reads on from there, missing nothing whatever its overlap. Undeclared, an incomplete scan moves nothing. Anopaquecursor takes the last item's token, so it requires the declaration.What polling promises: the revisions it observes. A tick re-reads
overlapbefore the checkpoint so equal timestamps and late-visible records are seen again, and a seen set of (item_id,item_version) removes what was already accepted. An entity changed twice between two ticks yields one event, its observed revision; a record that becomes visible later thanoverlapis missed. That is the honest contract of snapshot polling, and the catalog states it per trigger. Completeness needs a change-history source (see "Not decided here").Feeds. An RSS or Atom item's identity falls back from
guidtolinkto the digest of its canonical content; its version is that content digest. The seen set retains an identity while its entry is still in the feed, plusITERION_CONNECTOR_POLL_SEEN_RETENTIONafter it leaves, so an item is seen once for as long as it is observable.Accept, then checkpoint, under a fence. Every observed item becomes an intake row, idempotent on (poller,
item_id,item_version), before the checkpoint moves (ADR-094's order).pkg/leaseelects a holder but issues no fencing token, so the poller's own record carries one: a holder that takes over increments a generation by compare-and-swap, every checkpoint write carries it, and a write from an older generation — or a lower checkpoint — is refused. Two holders overlapping produce duplicate intake attempts, which the identity absorbs.Eligibility is iterion's sequence, not the vendor's clock. Intake rows carry a per-poller sequence number. A subscription records the sequence at its activation and receives only intakes above it, so a late-visible item whose source timestamp predates the activation is still delivered. A new poller's first scan records its intakes as primed — durable, matched to nothing — so enabling a source never replays a backlog.
backfill: Non a subscription makes the last N primed or earlier intakes of its poller eligible for it alone.Outbound authority. Polling, provisioning and selectors spend the connection's credential, which the
triggergrant does not authorize (pkg/connection/connection.go). They go through the connection resolver like anaction:node — status, expiry, maturity, origin and placement checked — and need theactiongrant; the wizard asks for both in one consent.Guards and bounds. The operation runs server-side through
pkg/connector/execbehind the cloud client's SSRF-guarded dialer, which refuses a private address.execgains aformat: feeddecoder (RSS 2.0, Atom 1.0,encoding/xml, no new dependency).interval.minholds unlessITERION_CONNECTOR_POLL_MIN_INTERVALlowers it.As built (L4-1).
spec.Triggergainsdeliveryandpoll(pkg/connector/spec/poll.go), validated at load with the package against whatexec.CallPagedactually does: the operation is a read of the same package; the walk owns the page and cursor parameters (keyed throughspec.ParamKeyForWire, which the walk reads too), sopoll.paramsmay not build them, a required parameter the walk does not send on the first page is refused, and a required size counts as built only when the pagination declares a default size; every param is evaluated at load as the first tick sees it and, with a cursor, as a later tick does; params readquery.<field>andcursor.valueby name, acursor:block is read by some param and vice versa; a paginated operation's items are its pagination's (poll.itemsrefused there, required otherwise) and its identity readsitemonly;item_idis required, numbers are canonical decimals and refused at 2^53; a cursor istimestamp(read byspec.ParseInstant, numeric zones or RFC 822's named ones at their own offset) oropaque(a scalar);interval.minis at least a second. A polled trigger declares no event; both lanes that route a delivery by event name go throughspec.WebhookTrigger, which skips polled triggers and matches nothing on an empty name, andbinding.Matcher.Triggerrefuses an event that did not come the way its trigger is fed (ingress versus poller). Two webhook triggers on one event are refused. The sample is{"response": …}, each item an object proven for identity and cursor, each output reading something on some item.HTTPBinding.response_format: feeddecodes a 2xx answer throughexec's RSS 2.0 / Atom 1.0 decoder (pkg/connector/exec/feed.go): a bounded token pre-pass (ITERION_CONNECTOR_FEED_MAX_ITEMS,ITERION_CONNECTOR_FEED_MAX_DEPTH, refused past either), RSS fields matched in their own namespace, the header's charset over the document's, WHATWG's UTF-8 and windows-1252 labels, a version hashing every field a reader sees; a feed cannot carry a JSON response contract.spec.Package.DeliverableTriggers(webhook triggers of a package with an ingress) is what the catalogue offers and what an ingress bind requires; a subscription to a polled trigger, or to a trigger of a package with no ingress, is refused at save until pollers ship (L4-2).As built (L4-2).
pkg/connector/pollerholds the record and its fence in three twins (memory, a journal under the run store, Mongoconnector_pollersandconnector_poller_seen):Acquiretakes the next generation by compare-and-swap, andReserve(the intake sequence) andComplete(the checkpoint, never moved back for a timestamp; the priming, once, with the sequence it reached) refuse a lost generation.pkg/connector/pollingis the tick, run by the elected netconnector-pollers: the subscribers listed by poller, the trigger re-read from the tenant's catalog, the operation resolved throughResolver.ResolveActionByConnectionunderconnection.TrustOfTenantConfiguration(theactiongrant, the connection's own origin), its params frombinding.PollQueryValuesand the checkpoint less the overlap (cursor.value, andcursor.epoch_msfor a timestamp), the walk on the tier's guarded client with JSON numbers kept as literals (exec.Executor.PreciseNumbers), each unseen item read throughingress.ReadItemand accepted —primeduntil the first complete scan — then the seen set marked, then the checkpoint.binding.ValidateSubscriptionderivesPollerfrompoll_queryon every save; the server ensures the poller before the subscription and setsPollerSinceat each activation;binding.Eligiblekeeps a polled intake for the subscriptions activated below its sequence; abackfillis paired by the tick once the poller is primed, throughMatcher.Rejudgeandintake.PairsOf, then marked done. Connections gained the scheme kindnoneand the route-createdbasic; an operationat_base_urlis sent to the connection's URL as written. A poller with no subscriber goes dormant (an idleCompleteunprimes it and moves a timestamp checkpoint to that instant;Store.Wakeat activation), so neither a resume nor a new subscription launches what changed meanwhile; the first settled tick of an activation pairs what was matched between the save and the subscription landing, then its backfill. A pass ticks pollers concurrently under a per-scan deadline, reports alease.PassVerdictto the lease's health, and a poller's error is recorded on its subscriptions' last error. A feed entry's version hashes its visible text. Shipped:rssandjira.issue.changed(its first scan bounded to the last day,not_matchingrefusing anORDER BY); the example above predates them and is the shape, not a package that loads. How a scan longer than its operation's page bound completes: the next bullet.As built (#3396, the answer's order).
spec.TriggerPoll.Order(order:) takes one value,oldest_first(spec.PollOrderOldestFirst); another is refused at load, and so is anopaquecursor without it. Declared on a timestamp cursor, a scan that stops before its last page — the page bound, a later page failing, the scan's deadline — moves the checkpoint to the latest instant it read in full, the one before the last it read (polling.tick.partial, under the boundstick.instantgives every timestamp checkpoint), reports why it stopped and does not prime, so a first answer longer than the bound primes on the tick whose scan completes.jira.issue.changeddeclares it, and the shipped-package witness checks a declared answer ascending against the vendor's double. Open: a page bound whose items all share one instant, or more changes within one overlap window than the bound holds, stall an oldest-first checkpoint, and a stopped scan never moves an opaque one.
8. From intake to effect
- Accepted means durable. After verification and admission (§3) the lane answers a handshake if it is one, applies
ignore, extracts the outputs and writes an intake row — the sanitized event, its connection, ingress or poller, trigger id, dedup identity and sequence — then answersack. A redelivery with the same dedup identity meets the existing row and is answeredackwithout a second one. - Matching runs after the answer, and its outcome is stored. A worker claims an intake, lists its candidate subscriptions in a stable order (by subscription id), evaluates each one's filters and
when, and writes one pair per candidate into a pair store of its own, keyed uniquely on (intake id, subscription id): matched, not matched, or refused with its reason — an expression that exhausted its budget is a refused pair, visible and replayable, never a silent omission. Every writer — the matcher, an activation's catch-up, a backfill — builds a pair through one constructor,intake.PairFor, and the store refuses a pair built any other way: a polled pair carries its item's key, the item at its version within its tenant's connection and trigger (intake.PolledItemKey), the same on every poller of that connection and trigger that accepts the revision. The intake is marked matched only when every candidate has its pair. A fan-out of any width is so many rows, not one growing document. - A pair's launch identity is its submission. A matched pair launches as an idempotent submission keyed by (pair, epoch) —
LaunchSpec.SubmissionKey(pkg/runview/submission.go) — and the launch path derives the run id from the key and the tenant, in a namespace no caller-chosen run id may enter. The launch path owes one property in return: submitting a key whose run already exists answers from that run instead of failing or creating another. A cloud run still queued by the launch path's own attempt — no runner claimed it, no resume re-queued it (store.Run.SubmissionAttemptAt) — is completed as a new attempt: re-persisted under compare-and-swap on the version it was judged at, with aqueued_atof its own, and published under a message identity of its own. A runner claims a queued run only for a delivery published at or after itsqueued_at, so a first publication that did land is retired and one attempt is ever executable; the completion supersedes the first attempt's pool lease, as a resume does. A run that was handed on — claimed, parked, re-queued by a resume — is answered as it stands. A run that never left its launch path (LAUNCH_FAILED, terminal by the store's doctrine) has spent its id: the pair's epoch advances, the next attempt submits under the next key, and the failed run stays visible. A pair islaunchedonly once the submission is acknowledged; a run record that exists proves nothing more than a submission to complete. A polled pair is not launched when its subscription already holds a launched pair of the same item key — the revision delivered through another poller, which a subscription moved to another query meets on the poller it joins: the launch refuses it, naming that pair and its run, before any submission (intake.Worker,Store.LaunchedPair), and its replay answers the same. Only a launched pair counts: one the launch refused because its subscription had moved off its poller, a dead one, or one still owed delivered nothing, and the revision launches once through the new poller. Three windows stay open, a duplicate preferred to a loss: a first submission acknowledged but not yet marked launched when the second pair is judged; pairs written before #3396, which carry no item key, so a revision delivered before that deploy can be delivered once more after it; and a pair that expires with its intake, so a poller lagging past the intake retention delivers the revision again. - Transient failures retry; exhausted ones are visible. A pair moves
pending → claimed(owner, generation, expiry) → launched | refused | dead, and a failed attempt re-enterspendingwith backoff (ITERION_CONNECTOR_PAIR_MAX_ATTEMPTS,…_BACKOFF) until its attempts are spent, astrigger.EffectOutbox'sMarkRetryalready does for board effects; a maintenance hold postpones without spending one. Every write is fenced by the claim's generation, and a write under a lost claim fails rather than landing. A claim past its expiry is claimable again and the reclaim spends an attempt; the work under a claim is bounded to half its lifetime, so a worker that overruns has returned before another can take the row. A pair out of attempts, and an intake whose matching keeps failing, land in the dead-letter view and are replayable from it. A dead pair's replay re-submits its current key — its last attempt may have been handed on, and the launch path then answers with that run; a pair the launch path refused replays under its next key; a pair refused by matching is not replayed into a launch, since no filter ever matched it, and is re-judged by matching instead. - The bus hears it, observationally — readers first. The lane publishes each event with an explicit
observationalmarker, and the evaluator skips marked events whatever their payload. Rollout is reader-first: a release whose evaluators honour the marker ships before any publisher emits an event that carries the marker without a launched run id; until then publishers keep the run id and do not publish filtered or zero-success events. - Modes.
directlaunches through the shared launch path, with its quota, routing, trust and var layers.boardanddeliverare refused (§6). - As built (L1d).
binding.Matcherjudges an intake against its connection's candidates; a connector gone from the catalog, an unloadable package, an undeclared trigger or an undecodable event refuse every candidate's pair, naming why, while an outage is retried. The submitter re-reads the subscription and re-judges it at launch (deleted, disabled, re-bound, re-filtered: refused), computes the vars then, believes arepo_urlon the connection's host or one its ingress lists inrepo_hosts, and launches under the pair's key with the connector provenance (RunSource.ScheduleIDnames the subscription, so the run-outcome spine stamps it;pair_id,intake_id). The trigger launcher asks the run service first (AnswerSubmission): a key whose run was handed on is answered without charging the gate again. A concurrency or launch-rate denial postpones the pair by its wait without spending an attempt; a monthly cap or a suspension spends one. A replay of a pair matching refused re-judges it against the subscription as it stands (RejudgePair, #3296). Every replica runs the worker (ITERION_CONNECTOR_WORKER_INTERVAL, theITERION_CONNECTOR_PAIR_*/_INTAKE_*dials); the local studio keeps a durable intake beside its connections, which only polling and a future local ingress lane will fill. Open: a cloud run still queued is completed as a new attempt (§8.3), and that completion passes the gate again.
9. Expressions: one language, a context per site
Every expression is pkg/dsl/expr, under its existing per-expression work budget (ITERION_DSL_EVAL_BUDGET). The candidates a delivery is evaluated against are the tenant's own subscriptions, so a hostile payload controls the input, not the count; an exhausted budget is a per-pair verdict (§8.2). expr.Context gains named callbacks for the namespaces below, and an unknown root is an error at validation time, never the evaluator's implicit input fallback.
| Site | Namespaces | Validated at |
|---|---|---|
ingress.installation, event, handshake.when/respond | payload, headers (listed) | package load |
outputs[].from, filters[].from, ignore | payload, headers (listed) | package load |
poll.params | query, cursor | package load |
poll.items, item_id, item_version, cursor.from | response, item | package load |
provision.*.params, match, id_from | registration (url, secret, epoch, marker, scope, remote id), response (match, id_from) | package load |
subscription when, var_map | event (outputs, payload, headers) | subscription save |
ignore, handshake.when and a subscription's when read their value as a condition, as every guard in the language does (expr.Truthy): a set field holds, so payload.event.bot_id drops a bot's own message; nil, false, zero, an empty string, list or map, and the strings "false", "no", "0" do not. Read this way, a loop guard errs toward dropping, the safe side of a loop; an operation's success predicate would err toward reading a failure as success, so it must answer a boolean. An absent path evaluates to nil, and a nil output is absent: the var it maps to is not set, never set to an empty string. Values reach a launch as strings by one conversion — a string as is, a number in canonical decimal, a bool as true/false, a list or map as compact JSON. The preview and the lane call the same evaluator and conversion.
10. The catalog is a read model
GET /api/teams/{id}/sources (and /api/v1/sources locally) answers the packages that declare triggers across the tenant's tiers: presentation fields, maturity and tier, push or poll and what polling promises, the grants a source needs, its setup mode and replay protection, the tenant's connections, ingresses and pollers for it, and the subscriptions on each. Beside them it lists the built-in sources — schedule, board, run outcome, emit — as descriptors the studio routes to their existing dialogs. It stores nothing (philosophy §5).
As built (L2, #3272): the cards carry the presentation fields, the
maturity and tier, the delivery mode, the auth schemes, the declared
triggers with their outputs and filters, and the ingress contract
summary; a connection and a subscription count per tenant; the
built-ins route to their dialogs. Setup mode, the grants a source
needs and per-poller rows arrive with the waves that declare them
(L3, L4).
11. The Forgejo lane migrates under one authority at a time
The connector-bound Forgejo configs of #2761 are live, and a rolling deploy runs old and new replicas together. Two launchers that each believe they own a delivery would launch twice — the legacy lane keys its idempotency on the delivery record and lets the launch mint its own run id — so the migration never has two authorities:
- Release A (expand). The decoders accept every new field, and no shipped package uses one: an older replica must never meet a package it cannot decode (
pkg/connector/spec/triggers.godecodes strictly). Every replica of A reads, per delivery, anauthorityfield on the legacy config row: unset means the legacy lane,subscriptionsmeans the new one. A reconciler under a lease creates, for each connector-bound config, its ingress and subscription with deterministic ids, disabled. Nothing switches. - The switch, once the whole fleet runs A. One compare-and-swap writes
authority: subscriptionson the legacy row and enables the migrated subscription. Every replica reads the field per delivery, so exactly one lane owns each delivery at every instant. From then on the subscription is the record an operator edits, disables or deletes; the legacy row keeps only the pointer. - Rollback. To A: A reads the field and keeps the new lane. Below A, after the switch: the old code reads the legacy row as it was at the switch and never sees the intake rows, so rolling below A requires draining the intake first. That is an operator procedure the release notes state, and the dead-letter view's undrained count is what the operator checks before it.
- Release B (contract). The
forgejoIssueCommentstruct and the legacy branch are removed once no row lacks the switch.
Parity is the whole launch, without a Forgejo branch. The witness compares the complete launch request of a migrated delivery with today's — each var with its presence or absence (issue_number and comment_id are set only when non-zero), the operator's var layers and their precedence (applyWebhookVarLayers), the clone target now carried by the repo_url output under its trust rule, the run's trust class, routing, credential pins and launch policies — and the new lane reaches it through the package's declarations alone.
Consequences
- A new source whose wire contract fits the vocabulary costs a package: a
connector.yaml, atriggers.yaml, a logo, a sample, and provisioning operations or asetup.md— with asetup-poll.mdbeside it when its polled triggers need other steps than its webhook ones, which the wizard shows for a polled trigger instead. - The connector lane loses its last vendor name, under a single authority throughout its migration.
- One delivery can serve several bots, each with its own filters, mapping and connection, where a connector webhook launched exactly one.
- Three closed sets each gain one last member —
trigger.SourceConnector,webhooks.ProviderConnector, the invocation kindconnector— andModegainsdeliver, refused until #3136. - The launch path gains an idempotent submission by caller-chosen key, which any other at-least-once launcher can reuse.
- New durable state, each with its Mongo twin, its persistent local twin and its memory twin in the change that introduces it: the extended subscription and its tombstones, the ingress with its pinned contract, installation and provisioning state, the intake rows, the pairs, the pollers with their checkpoint, fence and seen set.
- The studio gains a catalog, a plug wizard, a dead-letter view and a logo component; the local server gains the connection, ingress and source routes.
Alternatives rejected
- An app aggregator at runtime (Composio, Pipedream, Nango). It puts a third party in every event's path and a vendor's catalog in place of the packages' — the opposite of #1072's decisions, which already refused an Activepieces worker and Pipedream at execution time. Declined by the operator on 2026-11-14. Reopens on a named deployment that needs a source no package can describe and accepts the third party.
- Binding in
webhooks.Config.BotRules. A second spine, out of reach of the board and schedule sources, the Automations view and the cloud subscription store. - Triggers declared in the
.bottext. A connection, a channel and a tenant are a deployment's facts. - A brand-icon package in the studio (simple-icons on npm). The logo would belong to the studio, so a team's own package could not bring its own.
- Matching inside the request. A vendor's acknowledgement deadline does not wait for N subscriptions, and a crash between the answer and the effects would lose what the vendor believes delivered.
- Two authorities sharing an idempotency key during the migration. The legacy launcher keys idempotency on its delivery record, not on the run, so a shared key would not stop two launches; one authority field read per delivery does.
- The lease as a fence.
pkg/leaseelects and expires; it does not order writes. The poller's own generation does. - A separate
effectfield besideMode. Two fields saying what a match does would disagree, and today's dispatch defaults the unknown to a launch. - An aggregate evaluation budget per delivery. The candidate count is the tenant's own; a per-pair verdict keeps every subscription's outcome visible instead of letting an early one starve the rest.
- A JSONPath library for extraction. A second expression language beside the DSL's.
Not decided here
- The
delivermode's semantics — the standing-bot address, the host door, the queue, the no-live-run policy, the successor when a run's budget is spent: #3135, then #3136. - Turning an external event into a board card — its title and body, its identity across updates, grouping, the dispatcher staying the launch authority. Until then
boardis refused on connector subscriptions. - Complete change capture — a vendor's change-history or audit source (Jira's changelog) behind a periodic reconciliation, for a subscription that must see every revision rather than the observed ones.
- Streaming sources (Slack Socket Mode, a Mattermost websocket): an elected holder of a long-lived connection per tenant. They reopen on a source that offers neither a webhook nor a poll.
- Slack distributed apps (one app, many workspaces, OAuth installs): #1072's P2 managed OAuth apps. The first wave binds one app to one connection.
- GraphQL operations in the executor, which Linear's hook provisioning and selectors would need.
- Distributing packages through the marketplace: #1072 refused marketplace installs in cloud, and that stands.
Witnesses this record owes
- Verification. For each scheme and credential location, with real vendor signature fixtures (Slack, Linear, Forgejo, Jira, Sentry): a wrong secret, a missing or repeated credential field, a timestamp outside the window in seconds and in milliseconds answer 401 and leave the intake store, the monthly counter and the per-webhook bucket unchanged. Skip the verification, and each test fails.
- Identity and installation. A captured signed request with a changed delivery-id header opens no second intake, nor does a vendor's retry re-signed at a later instant; a Slack delivery signed by the right app for another
team_idis refused. - The pin. A team override that weakens a baked package's verification is refused until re-bound.
- The canary. A unique value in the credential field and in an unlisted header reaches no expression, preview, intake row, bus event or run.
- Isolation. Two connections to one vendor in one tenant, and two overlapping pollers: each delivery reaches only its own subscriptions, once — checked against a real Mongo, its index created and its query plan read.
- The pair machine. A crash before the launch, after the run is persisted but before it is published, and after publication but before the pair is marked, each end with exactly one published run. A returned launch error retries with backoff and lands in the dead-letter view when its attempts are spent; replay launches it once. Each built in both orders.
- The answer and the backlog. An accepted delivery is answered with the package's exact
ackwhile matching is pending; over the backlog cap the answer is 503 and nothing is written. - Polling. An older generation's checkpoint write and a lower value are refused immediately after a takeover; a crash between intake and checkpoint loses nothing; an incomplete scan advances only a timestamp checkpoint of an answer declared oldest first, to the last instant it read in full, never back nor past its clock, and primes only once a scan completes; equal timestamps across a page boundary are neither skipped nor doubled; a late-visible item older than a subscription's activation still reaches it; an RSS item without
guidorlinkis seen once while it stays in the feed; a private feed URL is refused. - Modes.
deliverthrough everyFrom*Invocationbuilder and the forge dispatch, andboardon a connector subscription, answerunsupportedand launch nothing. An observational event is never re-evaluated, including by a reader of the previous release. - Invocations and restarts. One bot with a Slack and a Jira invocation gets two subscriptions; repeated local restarts keep their ids and honour a tombstone; a restart with an empty manifest scan still drains saved intake.
- Migration. A migrated Forgejo delivery produces the same complete launch request as today; across the switch on a mixed fleet, one delivery launches one run.
- The seam. Each first-wave package lands with an empty diff outside
connectors/. - The logo. An
icon.svgcarrying<script>and an externalhrefis served without them, with the CSP header.
Adversarial review disposition
Each finding was checked against the code before its disposition; the ones with the widest blast radius were reproduced by reading the cited lines.
Round one (codex gpt-6-astra, xhigh — 22 findings)
- Adopted — F1 the pair state machine with a recoverable launch identity · F2 credential and timestamp locations, units and body encoding · F3 the sanitized event and its canary · F4 admission after verification, for every lane (the existing lanes are fixed by #3276) · F5 the pinned contract · F6 the connection on the event and the index · F7 entity versus version · F8 complete scans, overlap and the seen set · F9 accept before checkpoint, a fenced monotonic checkpoint · F10 a beginning per subscription · F11 a migration in stages · F12 parity on the whole launch request · F13 persistent local stores · F14 provisioning on ADR-138's discipline · F15 outbound operations through the resolver under the
actiongrant · F17 the observational marker · F18Modeas the one discriminator · F19 the declaredackafter a durable intake · F21 invocation identity and the connector builder · F22 a context per expression site. - Adjusted — F16 the board effect needs an existing card:
boardis refused on connector subscriptions and materialization is named as undecided · F20 the wizard's routes and the setup matrix are adopted; Linear's setup is manual because the executor speaks no GraphQL yet.
Round two (codex gpt-6-astra, xhigh — 22 findings)
- Adopted — F1, F4 one authority field read per delivery, switched by compare-and-swap once the fleet is homogeneous, with rollback and drain rules (§11) · F2 a pair is launched only once its submission is acknowledged; the launch path completes an existing run id's submission · F3 retries with backoff, attempt limits, a dead-letter view and replay · F5 unsupported kinds and modes refused in every builder and dispatcher · F6
{timestamp}required only for a header timestamp · F7 a poller is a query; intakes match only its subscriptions · F8 eligibility by iterion's intake sequence; durable priming · F9 one ingress per (connection, registration scope) · F10 the authenticated installation · F11 dedup on signed material; vendor delivery ids are metadata · F12repo_url/repo_refoutputs under a host trust rule · F13 reader-first rollout of the marker · F14 a scalarconnector_keyindex · F15 pagination by the operation's contract; an incomplete scan never advances · F17 feed identity by content digest, retention while the entry is observable · F18 a fence the poller record issues, sincepkg/leasehas none · F19list,matchand the registration context; zero, one and several matches · F21 a pair store of its own; a backlog cap before the answer · F22 stable ids, tombstones, workers started from durable state. - Adjusted — F16 polling promises the revisions it observes, stated per trigger; complete capture is named as undecided rather than promised · F20 the aggregate budget is removed rather than given progress semantics: the candidate count is the tenant's own, and an exhausted per-expression budget is a visible, replayable pair verdict.
