feat(runs): authorize runs, deliveries and intake as the workload principal (#2078)

Trigger dispatch, run start, every run claim, every delivery attempt and
webhook intake now ask the policy chain. Background work acts as the
workload principal; a refusal is final and recorded on the run or the
delivery, and an undecidable chain leaves the work queued for another
attempt. Intake applies the per-source delivery policy after source
verification.
This commit is contained in:
sam committed 2026-11-22 02:15:05 +11:00
1 parent 6c59d6b742
commit 098d8cc328
12 files changed
+639 -42

No files matched your search

+10 -3
View File
@@ -55,11 +55,15 @@ func (o *operations) Start(ctx context.Context) error {
if err != nil {
return err
}
// Every entry point asks the same chain, and each refusal is stored as a
// denial.
checked := governance.Recording(access, o.settings, o.log.With("module", "governance"))
// A workflow takes its context from the run handle, as a handler takes it
// from the request.
o.engine.Use(runs.Deps{
Settings: o.settings, Toolbox: o.conns, Judge: o.judge, Approver: o.allow,
Notifier: o.tell, Messenger: o.tell, Memory: o.remember, Capabilities: o.conns,
Access: checked,
})
if err := installStarter(ctx, o.engine); err != nil {
return err
@@ -76,9 +80,12 @@ func (o *operations) Start(ctx context.Context) error {
// Nothing below can fail, so a retry cannot launch a connector or a loop twice.
o.checks.Register("connectors", o.conns.Ready)
// Administrative writes are checked against the same live policy chain as
// every other request.
o.settings.UseAuthorizer(access)
// Administrative writes, and every API request, are checked against the same
// live policy chain as chat and background work. The webhook intake applies
// each source's delivery policy from it.
o.settings.UseAuthorizer(checked)
o.tell.UseAccess(checked)
o.hear.UseDeliveryPolicy(access)
o.talk.Use(chat.Deps{
People: o.settings, Access: access, Settings: o.settings, Toolbox: o.conns, Judge: o.judge,
Approver: o.allow, Memory: o.remember, Runs: o.engine, Notifier: o.tell,