Chat-triggered workflows are classified by transitive effects and run under a declared execution contract #2079

Open
opened 2026-11-20 09:52:14 +00:00 by sam · 0 comments
Owner

Why: Chat cannot start a workflow today, but nothing structural stands between a chat turn and a workflow run: runs are started by triggers and schedules with no initiator, no grant check and no declared execution identity, and a workflow's danger is judged only step by step as actions execute. The RFC makes workflow:execute plus an input schema insufficient — a read step feeding a send step is a disclosure no single step's tier captures — and a schedule must be bound to a revocable grant, not to whoever happened to create it.

Today: modules/chat/tools.go builtins() offers only run_list, run_get, approval_list, memory_list/memory_save/memory_forget and dashboard_navigate — there is no chat tool that starts a workflow. Runs start from modules/events/events.go dispatch (one run per matching trigger, keyed by event id and trigger) and tick (interval schedules), via runs.Start, which checks only that the workflow exists, parses and accepts the input (modules/runs/runs.go); CheckTrigger checks the same for triggers. A run pins its version at start (loadDocument loads run.Version), but nothing classifies the document's transitive effects: modules/runs/checks.go validates the step vocabulary only (switch, parallel and retry are rejected as unsupported), and each agent tool call is judged individually in call/runUnattended/settleOne (modules/runs/interpreter.go) with the workflow name as judgement's Workflow principal (rc.request in modules/runs/dry.go) — no read-then-send composition is detected. There is no execution contract: runs carry no initiator or on-behalf-of person and no run-as identity (Options.Owner is the process name for leases), schedules (every on triggers) have no owner, expiry or per-run recheck, and disabling or removing a person stops nothing. The permission vocabulary has KindWorkflow and ActionRun (modules/governance/access.go) and the shipped role policies grant run, but no code calls Authorize on a workflow resource before Start.

Source: the revised RFC exported at transcripts/2026-11-20-chat-authorization-rfc-3fa43269.md in sam/archie-product; citations below are RFC section numbers.

Required behaviour:

  1. Classify the transitive effects of nested workflows, branches, dynamic steps, destinations and subagents before a workflow is chat-eligible: a read step followed by a send step creates a disclosure the maximum tier of either step does not capture (RFC 5.3).
  2. Pin the executable version at start and reauthorize each protected step at execution (RFC 5.3).
  3. A legacy workflow with unknown effects, unrestricted scripts or implicit run-as-owner credentials is not chat-eligible until wrapped or migrated (RFC 5.3, RFC 8 rollout).
  4. Chat-triggered work runs under one of two declared execution contracts: (a) on-behalf-of-a-person, bound to a revocable user grant, recording owner, exact workflow version, inputs or allowed ranges, destinations, frequency, expiry and cumulative limits, with the grant, user status and current policy rechecked at every run and consequential step — pausing the originating chat does not cancel queued work; or (b) an organizational service workflow, where the user is authorized to request the operation, not to acquire the service principal's rights, with service ownership, input validation, approval, recipient policy and per-step service authority governed separately; a departed employee's schedule is never silently converted into this mode (RFC 5.3).
  5. Workflow/job permissions stay separate: view_definition, run_version, schedule, cancel, publish, manage_run_identity; running a workflow confers neither edit rights nor the owner's authority, and scheduling is a separate grant from a one-time run (RFC 2).
  6. A chat-callable workflow trigger is a meta-tool: it needs the same versioned manifest (owner, schemas, effects, destinations, limits, approval requirements) and cumulative limits across turns as any other tool (RFC 5.1).

Out of scope: tool discovery (#2067), taint (#2068), memory scopes (#2069), connector credential modes (#2070), admin tools refused in chat (#2071), approval binding (#2072), image/CSP (#2073), budgets and rate limits (#2074 — the cumulative limits here are the workflow-level ones RFC 5.3 names), audit/revocation/kill-switch (#2075), plus the disclosure-per-audience issue and the enforcement-parity issue filed alongside this one. Beyond those, this issue does not cover the workflow step vocabulary or DSL, judgement guard internals, or approval card mechanics.

Design notes: owning modules: modules/chat for the trigger tool (builtins()), modules/runs for effect classification at Install/validateDocument and version pinning in Start/loadDocument, modules/events for triggers and schedules (putTrigger, tick), modules/governance for the KindWorkflow run/schedule grants. Seams: Engine.Start/CheckTrigger, dispatch, Context.request. Pitfalls: a resumed turn still acts as its owner, so the grant is re-read from current memberships; never take the workflow name, version or "run as me" from the model; deny by default — a document whose effects cannot be classified is not chat-eligible; fail closed when policy or grant lookup is unavailable. Migrations: the runs table needs initiator and execution-contract fields; triggers and schedules need owner, expiry and contract.

Tests: security-seam table tests with fakes, no DB:

  • a workflow combining a read step and a send step is classified with the disclosure effect even when each step alone is read-tier;
  • a chat trigger call without run on the workflow resource is refused before Start;
  • a workflow with unclassifiable effects is refused as a chat trigger, and is only runnable once explicitly wrapped or marked eligible;
  • a scheduled run whose owner's grant was revoked between scheduling and firing starts no protected step;
  • an on-behalf-of run records owner, pinned version, input ranges, destinations, frequency, expiry and cumulative limits, and rechecks the grant at each run;
  • a service-contract request grants the requester no service-principal rights (fake authorizer asserts the operation runs under the service identity, not the user's);
  • publishing a new workflow version mid-run does not change the running version, and each protected step is reauthorized before executing.

Done when: task check passes with the new tests. Manual check on a running binary (task dev): from chat, trigger a workflow the person may run — the run's trail shows the pinned version, the declared execution contract and a reauthorization on each protected step; trigger one without the grant — refused; remove the grant from a scheduled workflow — its next firing executes no protected step.

Open questions for the maintainer: should chat gain a workflow-trigger tool in the first release, or should chat-triggered runs go through an explicit request-and-approval action instead; which existing workflows, if any, are intended as organizational service operations, and who owns their service principal today; what happens to a departed person's schedules — reassign by policy to a named owner, or require manual takeover?

Part of #2066.

**Why**: Chat cannot start a workflow today, but nothing structural stands between a chat turn and a workflow run: runs are started by triggers and schedules with no initiator, no grant check and no declared execution identity, and a workflow's danger is judged only step by step as actions execute. The RFC makes `workflow:execute` plus an input schema insufficient — a read step feeding a send step is a disclosure no single step's tier captures — and a schedule must be bound to a revocable grant, not to whoever happened to create it. **Today**: `modules/chat/tools.go` `builtins()` offers only `run_list`, `run_get`, `approval_list`, `memory_list`/`memory_save`/`memory_forget` and `dashboard_navigate` — there is no chat tool that starts a workflow. Runs start from `modules/events/events.go` `dispatch` (one run per matching trigger, keyed by event id and trigger) and `tick` (interval schedules), via `runs.Start`, which checks only that the workflow exists, parses and accepts the input (`modules/runs/runs.go`); `CheckTrigger` checks the same for triggers. A run pins its version at start (`loadDocument` loads `run.Version`), but nothing classifies the document's transitive effects: `modules/runs/checks.go` validates the step vocabulary only (switch, parallel and retry are rejected as unsupported), and each agent tool call is judged individually in `call`/`runUnattended`/`settleOne` (`modules/runs/interpreter.go`) with the workflow name as judgement's `Workflow` principal (`rc.request` in `modules/runs/dry.go`) — no read-then-send composition is detected. There is no execution contract: runs carry no initiator or on-behalf-of person and no run-as identity (`Options.Owner` is the process name for leases), schedules (`every` on triggers) have no owner, expiry or per-run recheck, and disabling or removing a person stops nothing. The permission vocabulary has `KindWorkflow` and `ActionRun` (`modules/governance/access.go`) and the shipped role policies grant `run`, but no code calls `Authorize` on a workflow resource before `Start`. **Source**: the revised RFC exported at transcripts/2026-11-20-chat-authorization-rfc-3fa43269.md in sam/archie-product; citations below are RFC section numbers. **Required behaviour**: 1. Classify the transitive effects of nested workflows, branches, dynamic steps, destinations and subagents before a workflow is chat-eligible: a read step followed by a send step creates a disclosure the maximum tier of either step does not capture (RFC 5.3). 2. Pin the executable version at start and reauthorize each protected step at execution (RFC 5.3). 3. A legacy workflow with unknown effects, unrestricted scripts or implicit run-as-owner credentials is not chat-eligible until wrapped or migrated (RFC 5.3, RFC 8 rollout). 4. Chat-triggered work runs under one of two declared execution contracts: (a) on-behalf-of-a-person, bound to a revocable user grant, recording owner, exact workflow version, inputs or allowed ranges, destinations, frequency, expiry and cumulative limits, with the grant, user status and current policy rechecked at every run and consequential step — pausing the originating chat does not cancel queued work; or (b) an organizational service workflow, where the user is authorized to request the operation, not to acquire the service principal's rights, with service ownership, input validation, approval, recipient policy and per-step service authority governed separately; a departed employee's schedule is never silently converted into this mode (RFC 5.3). 5. Workflow/job permissions stay separate: view_definition, run_version, schedule, cancel, publish, manage_run_identity; running a workflow confers neither edit rights nor the owner's authority, and scheduling is a separate grant from a one-time run (RFC 2). 6. A chat-callable workflow trigger is a meta-tool: it needs the same versioned manifest (owner, schemas, effects, destinations, limits, approval requirements) and cumulative limits across turns as any other tool (RFC 5.1). **Out of scope**: tool discovery (#2067), taint (#2068), memory scopes (#2069), connector credential modes (#2070), admin tools refused in chat (#2071), approval binding (#2072), image/CSP (#2073), budgets and rate limits (#2074 — the cumulative limits here are the workflow-level ones RFC 5.3 names), audit/revocation/kill-switch (#2075), plus the disclosure-per-audience issue and the enforcement-parity issue filed alongside this one. Beyond those, this issue does not cover the workflow step vocabulary or DSL, judgement guard internals, or approval card mechanics. **Design notes**: owning modules: `modules/chat` for the trigger tool (`builtins()`), `modules/runs` for effect classification at `Install`/`validateDocument` and version pinning in `Start`/`loadDocument`, `modules/events` for triggers and schedules (`putTrigger`, `tick`), `modules/governance` for the `KindWorkflow` run/schedule grants. Seams: `Engine.Start`/`CheckTrigger`, `dispatch`, `Context.request`. Pitfalls: a resumed turn still acts as its owner, so the grant is re-read from current memberships; never take the workflow name, version or "run as me" from the model; deny by default — a document whose effects cannot be classified is not chat-eligible; fail closed when policy or grant lookup is unavailable. Migrations: the runs table needs initiator and execution-contract fields; triggers and schedules need owner, expiry and contract. **Tests**: security-seam table tests with fakes, no DB: - a workflow combining a read step and a send step is classified with the disclosure effect even when each step alone is read-tier; - a chat trigger call without `run` on the workflow resource is refused before `Start`; - a workflow with unclassifiable effects is refused as a chat trigger, and is only runnable once explicitly wrapped or marked eligible; - a scheduled run whose owner's grant was revoked between scheduling and firing starts no protected step; - an on-behalf-of run records owner, pinned version, input ranges, destinations, frequency, expiry and cumulative limits, and rechecks the grant at each run; - a service-contract request grants the requester no service-principal rights (fake authorizer asserts the operation runs under the service identity, not the user's); - publishing a new workflow version mid-run does not change the running version, and each protected step is reauthorized before executing. **Done when**: `task check` passes with the new tests. Manual check on a running binary (`task dev`): from chat, trigger a workflow the person may run — the run's trail shows the pinned version, the declared execution contract and a reauthorization on each protected step; trigger one without the grant — refused; remove the grant from a scheduled workflow — its next firing executes no protected step. **Open questions for the maintainer**: should chat gain a workflow-trigger tool in the first release, or should chat-triggered runs go through an explicit request-and-approval action instead; which existing workflows, if any, are intended as organizational service operations, and who owns their service principal today; what happens to a departed person's schedules — reassign by policy to a named owner, or require manual takeover? Part of #2066.
sam added a new dependency 2026-11-20 09:52:50 +00:00
sam added the featurehigh labels 2026-11-20 09:52:50 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#2079