🛡️ Pipeline Overview
GOVERNANCE GATE SEQUENCE
gateway_unreachableIs the target gateway healthy? Blocks if offline.
agent_unavailableIs the agent available? Blocks if paused, terminated, or in error state.
agent_busyIs the agent below its concurrency limit? Retryable.
rate_limit_exceededIs the agent within its rate limit? Checked via @convex-dev/rate-limiter.
budget_exceededHas the agent exhausted its monthly budget? Not retryable.
budget_exceededAre all applicable budget envelopes (daily/weekly/monthly) within limits?
trust_insufficientDoes the agent’s trust level meet the gateway’s minimum?
context_blockedContext source class, freshness, and environment eligibility checks.
policy_blockedDo configured governance policies allow this dispatch? May block or require approval.
approval_requiredDoes a policy or step require human approval? Returns “hold” if yes and not yet granted.
FAIL-FAST: First block stops the pipeline. Remaining gates are skipped.
⚖️ Three Dispositions
Every governance evaluation produces a with one of three dispositions:| Disposition | Meaning | What happens |
|---|---|---|
| pass | All gates passed | Step is dispatched to the gateway for execution |
| block | A gate rejected the request | Step is marked failed. Error code and message are recorded. Retryable blocks trigger backoff retry. |
| hold | A policy requires approval | An approval record is created. The interpreter sleeps on a durable workflow event until the approval is resolved. |
🔍 Gate Details
Gate 1: gatewayHealth
Gate 2: agentStatus
Gate 3: concurrency
Gate 4: rateLimit
Gate 5: budgetAgent
Gate 6: budgetEnvelopes
Gate 7: trustLevel
Gate 8: contextTrust
Evaluates two sub-checks: Environment eligibility — If the worker role specifies allowed environments and the gateway has an environment, the gateway must be in the allowed list. Context trust — If the role hastrustedContextConfig:
- Context source class must be in
acceptedSourceClasses - If
requireFreshnessis set, context cannot bestaleorunknown - If
maxFreshnessMinutesis set, context age is checked against the window (default: 30 minutes)
Gate 9: policyRules
Gate 10: approvalRequired
🎯 Action Types
The governance engine supports three action types, each with different gate sequences:| Action type | Gate sequence | Use case |
|---|---|---|
step_dispatch | Full 10-gate sequence | Standard workflow step execution |
delegated_run_dispatch | Full sequence minus concurrency gate | Goal-based sub-run dispatch |
workflow_run_launch | authorityPosture → gatewayHealth → workflowReadiness → policyRules → approvalRequired | Pre-launch preflight check |
⚡ Fail-Fast Behavior
The pipeline is fail-fast: if any gate blocks, all remaining gates are recorded asskipped with reason "blocked_by_previous_gate". This means:
- A gateway health failure never reaches the budget check
- A concurrency limit never reaches the trust level check
- The first blocking gate determines the error code returned to the interpreter
📋 Audit Trail
Every governance decision is recorded in theauditEvents table:
| Event | Recorded when |
|---|---|
governance_decision | Every evaluation (pass, block, or hold) — includes full gate outcomes, snapshots, and structured explanation |
step_dispatched | After a pass decision, when the step is dispatched to Bridge |
safety_gate_rejected | When a gate blocks dispatch (includes error code and retryable flag) |
approval_created | When a hold creates a new approval record |
GovernanceDecision object attached to audit events includes:
gates[]— outcome of each gate (pass, fail, skipped)budgetSnapshot— agent budget and spend at decision timetrustSnapshot— agent trust level vs gateway minimumcontextTrustSnapshot— role trust config vs context provenanceroleSnapshot— resolved role, authority bounds, scope constraintsexplanation— structured, human-readable explanation derived from gate outcomes

