This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: envoy-gateway-wasm-fault-isolation-circuit-breaker

Envoy Gateway 1.2 WASM Filter Fault Isolation and Panic-Recovery Circuit Breaker

Enforces strict fault-isolation boundaries and deterministic failure semantics for custom WebAssembly (WASM) filters running on Envoy Gateway 1.2 data planes. Prevents data-plane worker crashes and control-plane cascading outages by mandating explicit fail-open/fail-closed states, execution timeouts, and consecutive panic trip limits within EnvoyExtensionPolicy resources.

Prohibited Anti-Pattern: Deploying Unbounded WASM Policy Filters without Panic Fallbacks or Worker Crash Shields

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Envoy Gateway 1.2 WASM Filter Fault Isolation and Panic-Recovery Circuit Breaker - Enforces strict fault-isolation boundaries and deterministic failure semantics for custom WebAssembly (WASM) filters running on Envoy Gateway 1.2 data planes. Prevents data-plane worker crashes and control-plane cascading outages by mandating explicit fail-open/fail-closed states, execution timeouts, and consecutive panic trip limits within EnvoyExtensionPolicy resources.
globs: k8s/**/*.yaml, deploy/**/*.yaml, infra/**/*.yaml, manifests/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/envoy-gateway-wasm-fault-isolation-circuit-breaker"
---

# Envoy Gateway 1.2 WASM Filter Fault Isolation and Panic-Recovery Circuit Breaker

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Deploying Unbounded WASM Policy Filters without Panic Fallbacks or Worker Crash Shields

## System Constraints
You are a Principal Infrastructure Architect enforcing fault isolation and circuit-breaking guardrails for Envoy Gateway 1.2 custom WASM extensions. You must reject any EnvoyExtensionPolicy manifest that lacks explicit failure modes, timeouts, and resource-bounded isolation envelopes.

## Strict Guidelines
- Engineers MUST ALWAYS declare an explicit `failOpen` boolean on all `wasm` filters inside `EnvoyExtensionPolicy` to ensure determinism during filter execution panics.
- Engineers MUST NOT rely on default Envoy WASM runtime failure handling, which can induce worker thread crashes and trigger pod crash-looping under poisoned HTTP payloads.
- Code SHOULD enforce strict WASM execution timeouts (`timeout`) and image pull backoffs within the extension specification to prevent event-loop stalls.
- Services MUST configure upstream circuit breakers on WASM remote fetches to isolate the ingress gateway from registry degradation.
- Components NEVER attach uncontained WASM filters globally at the `Gateway` level without validating fault isolation at the scoped `HTTPRoute` level first.

## Bad vs Good Implementations
### EnvoyExtensionPolicy WASM Fault Isolation Configuration

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Omits failOpen policy, execution timeouts, and checksums. If the WASM binary experiences an unhandled panic or the remote URL hangs, Envoy proxy workers will crash or deadlock, disrupting all ingress traffic across the entire Gateway listener.
```yaml
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyExtensionPolicy
metadata:
  name: auth-wasm-filter
  namespace: gateway-system
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: Gateway
    name: eg-edge-gateway
  wasm:
    - name: custom-auth
      code:
        type: HTTP
        http:
          url: https://registry.internal.net/wasm/auth:v1.2.0
```

#### Production Standard (Correct)
> **Standard**: Explicitly restricts target scope to a specific HTTPRoute, mandates deterministic failure semantics (failOpen: false enforces secure rejection without worker crash), specifies execution timeout (100ms), and uses an authenticated immutable OCI image.
```yaml
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyExtensionPolicy
metadata:
  name: auth-wasm-filter
  namespace: gateway-system
spec:
  targetRef:
    group: gateway.networking.k8s.io
    kind: HTTPRoute
    name: protected-route
  wasm:
    - name: custom-auth
      failOpen: false
      code:
        type: Image
        image:
          url: oci://internal-registry.infra.local/wasm/auth:v1.2.0
          pullSecretRef:
            name: wasm-registry-creds
      timeout: 100ms
```

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Envoy Gateway 1.2 WASM Filter Fault Isolation and Panic-Recovery Circuit Breaker

Envoy Gateway 1.2 WASM Filter Fault Isolation and Panic-Recovery Circuit Breaker defines an industrial-grade behavioral standard for devops engineering. Enforces strict fault-isolation boundaries and deterministic failure semantics for custom WebAssembly (WASM) filters running on Envoy Gateway 1.2 data planes. Prevents data-plane worker crashes and control-plane cascading outages by mandating explicit fail-open/fail-closed states, execution timeouts, and consecutive panic trip limits within EnvoyExtensionPolicy resources. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Deploying Unbounded WASM Policy Filters without Panic Fallbacks or Worker Crash Shields Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftDeploying Unbounded WASM Policy Filters without Panic Fallbacks or Worker Crash ShieldsCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS declare an explicit `failOpen` boolean on all `wasm` filters inside `EnvoyExtensionPolicy` to ensure determinism during filter execution panics.

Engineers MUST ALWAYS declare an explicit `failOpen` boolean on all `wasm` filters inside `EnvoyExtensionPolicy` to ensure determinism during filter execution panics.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT rely on default Envoy WASM runtime failure handling, which can induce worker thread crashes and trigger pod crash-looping under poisoned HTTP payloads.

Engineers MUST NOT rely on default Envoy WASM runtime failure handling, which can induce worker thread crashes and trigger pod crash-looping under poisoned HTTP payloads.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Code SHOULD enforce strict WASM execution timeouts (`timeout`) and image pull backoffs within the extension specification to prevent event-loop stalls.

Code SHOULD enforce strict WASM execution timeouts (`timeout`) and image pull backoffs within the extension specification to prevent event-loop stalls.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Services MUST configure upstream circuit breakers on WASM remote fetches to isolate the ingress gateway from registry degradation.

Services MUST configure upstream circuit breakers on WASM remote fetches to isolate the ingress gateway from registry degradation.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Components NEVER attach uncontained WASM filters globally at the `Gateway` level without validating fault isolation at the scoped `HTTPRoute` level first.

Components NEVER attach uncontained WASM filters globally at the `Gateway` level without validating fault isolation at the scoped `HTTPRoute` level first.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Envoy Gateway 1.2 WASM Filter Fault Isolation and Panic-Recovery Circuit Breaker critical for AI coding assistants?

Enforces strict fault-isolation boundaries and deterministic failure semantics for custom WebAssembly (WASM) filters running on Envoy Gateway 1.2 data planes. Prevents data-plane worker crashes and control-plane cascading outages by mandating explicit fail-open/fail-closed states, execution timeouts, and consecutive panic trip limits within EnvoyExtensionPolicy resources. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Deploying Unbounded WASM Policy Filters without Panic Fallbacks or Worker Crash Shields) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Envoy