Gate

A synchronization checkpoint that pauses execution until an explicit external resolution is received.

Overview

Gates introduce controlled pauses into plan execution. When execution reaches a Gate node, downstream tasks are suspended until the gate is explicitly resolved.

A gate may be resolved by humans, automated systems, policies, or external services. This allows plans to incorporate authorization, review, coordination, or waiting on real-world events that cannot be determined by execution alone.

Gates are commonly used for:

  • Human approvals — security reviews, compliance sign-offs, quality gates
  • Policy evaluations — automated checks against organizational rules
  • Quorum decisions — N-of-M approval requirements
  • External signals — waiting for webhooks, events, or other systems
  • Inter-plan coordination — one plan unblocking another

Once resolved, the gate produces a deterministic outcome that determines whether execution resumes or terminates.

Schema

yaml
apiVersion: planspec.io/v1alpha1
kind: Gate
metadata:
  name: string          # Required, unique identifier
  namespace: string     # Required, resource namespace
  labels: object        # Optional, key-value pairs
  annotations: object   # Optional, metadata
spec:
  gateType: string      # Required: approval | review | sign-off
  targetRef:            # Required, what this gate controls
    kind: string        # Target resource kind (e.g., Execution)
    name: string        # Target resource name
    apiVersion: string  # Optional, target API version
    namespace: string   # Optional, target namespace
    uid: string         # Optional, target UID
    nodeId: string      # Optional, specific node in a plan
  description: string   # Optional, purpose of the gate
  reviewers: string[]   # Optional, who can resolve
  requiredApprovers: number  # Optional, minimum approvals needed (default: 1)
  context: object       # Optional, additional context data
status:
  phase: string         # Pending | Waiting | Approved | Rejected
  conditions: object[]  # Status conditions
  reviewHistory: object[]  # History of resolution actions
  resolution: object    # Final resolution details
  observedGeneration: number  # Last observed generation
  decidedGeneration: number   # Generation when decision was made

Fields

Spec Fields

FieldTypeRequiredDescription
gateTypestringYesType of gate: approval, review, or sign-off
targetRefobjectYesReference to the controlled resource
targetRef.kindstringYesTarget kind (typically "Execution")
targetRef.namestringYesName of the target resource
targetRef.apiVersionstringNoAPI version of the target resource
targetRef.namespacestringNoNamespace of the target resource
targetRef.uidstringNoUID of the target resource
targetRef.nodeIdstringNoSpecific node ID in a plan graph
descriptionstringNoPurpose of this gate
reviewersstring[]NoWho can resolve (e.g., "team:security", "user:alice", "svc:policy-engine")
requiredApproversnumberNoMinimum number of approvals required (default: 1)
contextobjectNoAdditional context data for reviewers

Status Fields

FieldTypeDescription
phasestringCurrent gate phase
conditionsobject[]Status conditions with type, status, reason, message
reviewHistoryobject[]Array of review actions taken
resolutionobjectFinal resolution details (required when phase is terminal)
observedGenerationnumberLast observed spec generation
decidedGenerationnumberSpec generation when decision was made

Gate Phases

PhaseDescription
PendingGate created, waiting to become active
WaitingGate active, awaiting resolution
ApprovedGate resolved positively, execution may proceed
RejectedGate resolved negatively, execution blocked

Gate Types

TypePurpose
approvalGeneral approval to proceed
reviewCode, design, or artifact review checkpoint
sign-offFormal sign-off (compliance, legal, security)

While the schema defines three gate types, the resolver can be human or automated. Use the reviewers field with prefixes like svc:policy-engine or svc:external-webhook to indicate automated resolvers.

Review History Entry

FieldTypeRequiredDescription
reviewerstringYesIdentity of the reviewer
actionstringYesAction taken: approve, reject, comment
timestampstringYesWhen the action was taken (RFC3339)
commentstringNoOptional comment or reason
targetGenerationnumberNoSpec generation this action was taken against

Resolution Object

FieldTypeRequiredDescription
outcomestringYesFinal outcome: approved or rejected
actorsstring[]NoIdentifiers of reviewers who contributed
timestampstringYesWhen the resolution was made (RFC3339)
commentstringNoOptional summary comment

Examples

Human Approval Gate

yaml
apiVersion: planspec.io/v1alpha1
kind: Gate
metadata:
  name: security-review
  namespace: default
  labels:
    stage: pre-production
spec:
  gateType: review
  targetRef:
    kind: Execution
    name: user-auth-execution
    nodeId: security-review
  description: Security team must review authentication implementation before production deployment
  reviewers:
    - team:security
    - user:security-lead@example.com
  requiredApprovers: 2

Compliance Sign-off Gate

yaml
apiVersion: planspec.io/v1alpha1
kind: Gate
metadata:
  name: compliance-sign-off
  namespace: default
spec:
  gateType: sign-off
  targetRef:
    kind: Execution
    name: user-auth-execution
  description: Compliance sign-off for handling PII data
  reviewers:
    - team:compliance
  requiredApprovers: 1

Automated Policy Gate

Use approval type with a service account reviewer for automated policy checks:

yaml
apiVersion: planspec.io/v1alpha1
kind: Gate
metadata:
  name: cost-policy-check
  namespace: default
spec:
  gateType: approval
  targetRef:
    kind: Execution
    name: infrastructure-deployment
  description: Automated check that infrastructure changes are within budget
  reviewers:
    - svc:cost-policy-engine
  requiredApprovers: 1
  context:
    policyRef: cost-limits
    maxBudgetIncrease: 1000

External Webhook Gate

Use approval type with a service account for external system integration:

yaml
apiVersion: planspec.io/v1alpha1
kind: Gate
metadata:
  name: dependency-ready
  namespace: default
spec:
  gateType: approval
  targetRef:
    kind: Execution
    name: integration-tests
  description: Wait for upstream service deployment to complete
  reviewers:
    - svc:deployment-webhook
  context:
    webhookUrl: https://deploy-status.example.com/callback
    expectedSignal: deployment-complete

JSON Schema

The full JSON Schema is available at: Gate Schema

Next Steps