Skip to content

About

Fail-closed Autonomous SRE & State Rollback Engine with a Zero-Trust boundary: TypeScript/React Control Plane + isolated Python Execution Plane connected via HMAC-SHA256 Bridge v2.1.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

Vanguard SRE

TypeScript React Python Protocol Security License

Unified deterministic framework for operating autonomous Site Reliability Engineering (SRE) agents across a strict Zero Trust boundary between the reasoning/control layer and the OS-level execution layer.

Vanguard SRE Architecture

An LLM proposes plans, patch hypotheses, and diagnostics in the Control Plane (TypeScript / Node.js / React), while the Execution Plane (Python / Linux / WSL2) enforces deterministic step lifecycles, isolated verification, content-addressable storage (CAS), single-writer HMAC write-ahead logging (WAL), and three-layer rollbacks.


Architecture & Zero Trust Boundary

flowchart LR
    subgraph CP["Control Plane (TypeScript / React / Node.js)"]
        UI["Operator UI & HITL Gates"]
        LLM["LLM Planner & Hypothesis Engine"]
        API["Control Server & Audit Log"]
        UI --> API
        LLM --> API
    end

    subgraph BR["Zero-Trust Boundary"]
        BRIDGE["Bridge v2.1\nHMAC-SHA256 + Nonce\nFail-Closed Adapter"]
    end

    subgraph EP["Execution Plane (Python / Linux / WSL2)"]
        DAG["Deterministic DAG Runner"]
        SBX["Isolated Sandbox / OS Tools"]
        RB["3-Layer State Rollback Engine"]
        DAG --> SBX
        SBX -->|Failure / Drift| RB
    end

    API <-->|Signed Canonical JSON| BRIDGE
    BRIDGE <-->|Verified Commands & Telemetry| DAG
Loading
Plane Stack & Runtime Responsibilities Secret Isolation
control-plane/ TypeScript, Express, Vite, React, Zod, Firebase Auth/Firestore, WebSockets Multi-LLM routing, DAG visualization, RBAC + RFC 6238 TOTP 2FA, Telegram two-way HITL operator control, HMAC audit verification Holds GEMINI_API_KEY, optional LLM keys, TELEGRAM_BOT_TOKEN, GITHUB_TOKEN, TRANSPONDER_SECRET, VANGUARD_BRIDGE_HMAC_SECRET
execution-plane/ Python 3.10+, Linux/WSL2 primitives (fcntl, os.waitid, os.killpg, /proc, git) Deterministic Arbiter loop, ExternalVerifier isolated runner, EffectLedger idempotency WAL, BlobStore CAS, WorkspaceManager 3-layer rollback, BridgeCoreAdapter Receives only VANGUARD_BRIDGE_HMAC_SECRET and workspace config — zero access to LLM, Telegram, GitHub, or Firebase secrets

Both planes communicate exclusively over /ws/bridge using Bridge Protocol v2.1:

  • Fail-Closed HMAC-SHA256: Every frame is wrapped in { timestamp, nonce, signature, payload } and verified with constant-time comparison. Missing VANGUARD_BRIDGE_HMAC_SECRET blocks bridge startup and closes /ws/bridge with code 4003.
  • Canonical JSON Parity: Byte-for-byte deterministic serialization across TypeScript (protocolSchema.ts) and Python (vanguard_bridge_agent.py), verified by verify_parity.py.
  • Anti-Replay & TOCTOU Protection: 30-second timestamp skew window, TTL-pruned nonce deduplication, and git-commit anchor verification (expectedAnchorHash) on every human-in-the-loop (HITL) approval decision.
  • Non-Blocking Emergency Abort: Tasks run on background worker threads so EMERGENCY_ABORT immediately cancels pending HITL gates, kills background process groups via /proc, and restores the last verified git anchor.

Repository Layout

vanguard-sre/
├── control-plane/                # Web UI, Express REST API, /ws & /ws/bridge servers
│   ├── server.ts                 # HTTP/WS entrypoint and /ws/bridge HMAC gate
│   ├── server/                   # sreEngine.ts, protocolSchema.ts, llmRouter.ts, totp.ts, telegramBridge.ts, githubBridge.ts
│   ├── src/                      # React/Vite operator console
│   ├── firestore.rules           # Append-only auditLogs, owner-only 2FA secrets, RBAC rules
│   └── .env.example              # Control Plane environment template
├── execution-plane/              # Deterministic Python SRE core & bridge connector
│   ├── vanguard_bridge_agent.py  # Hardened WebSocket client (protocol v2.1, fail-closed)
│   ├── bridge_adapter.py         # Real adapter bridging /ws/bridge to Arbiter, EffectLedger & Transponder
│   ├── arbiter.py                # Step lifecycle, AST patch fingerprinting, 3-layer rollback
│   ├── transponder.py            # Single-writer HMAC-chained WAL (schema 1.1) + external anchor
│   ├── verifier.py               # Two-process isolated ExternalVerifier with baseline calibration
│   ├── workspace.py              # Git anchoring (L2) and /proc process-group isolation (L4)
│   ├── effects.py                # Idempotent EffectLedger (L3) with HITL approval hook
│   ├── blobstore.py              # Atomic SHA-256 Content-Addressable Storage
│   ├── audit.py                  # DAG state tracker and loop detector
│   ├── tests/test_sre.py         # Crash-tolerance & integrity suite (500 fork+SIGKILL cycles)
│   └── .env.example              # Isolated Execution Plane environment template
├── docs/
│   ├── security_spec.md          # Detailed threat model and cryptographic guarantees
│   └── architecture.png          # System architecture diagram
├── verify_parity.py              # Cross-language TS <-> Python HMAC & Canonical JSON parity suite
├── Makefile                      # Unified build, lint, test, and run targets
└── LICENSE                       # Apache-2.0


Execution Modes

Mode LLM Calls Host / Workspace Access Use Case
MOCK_DEMO None None (dryRun: true) Offline UI verification, rollback drills, HITL approval walkthroughs
AI_SANDBOX Real server-side LLM router (Zod-validated) Read-only (dryRun: true) Decomposing SRE tasks into DAG steps, patch hypotheses, and risk ratings without mutating files
LIVE_BRIDGE Optional planner + signed TASK_DISPATCH Local Linux/WSL2 workspace via vanguard_bridge_agent.py Full deterministic execution, isolated verification, HITL approval gates, and 3-layer git/process rollback

Quick Start

Prerequisites

  • Control Plane: Node.js 22+
  • Execution Plane: Python 3.10+ (pip install websockets) on Linux or WSL2 (required for fcntl, os.waitid, os.killpg, and /proc)

1. Start the Control Plane

cd control-plane
cp .env.example .env
# Set VANGUARD_BRIDGE_HMAC_SECRET (and optionally GEMINI_API_KEY) in control-plane/.env
npm install
npm run dev

2. Connect the Execution Plane (Linux / WSL2)

cd execution-plane
cp .env.example .env
# Set the exact same VANGUARD_BRIDGE_HMAC_SECRET in execution-plane/.env
pip install websockets
set -a && source .env && set +a
python3 vanguard_bridge_agent.py

Verification & Testing

Run the full verification matrix from the repository root:

# 1. Control Plane static type check & production bundle
cd control-plane && npm run lint && npm run build && cd ..

# 2. Cross-language Protocol v2.1 HMAC-SHA256 & Canonical JSON parity (TS <-> Python)
python3 verify_parity.py

# 3. Execution Plane crash-tolerance & rollback test suite (Linux / WSL2, default 500 cycles)
cd execution-plane && python3 -m unittest -v tests.test_sre

Or via Makefile (Linux / WSL2):

make verify

Security Policy & Limitations

  • Full cryptographic specifications, Firestore RBAC rules, SSRF filters, and ephemeral secret handling are documented in docs/security_spec.md.
  • Execution Plane MVP runs agent code under the host UID (container/user namespace isolation is planned for the next hardening phase). Keep VANGUARD_INVARIANT_SPEC outside VANGUARD_WORKSPACE_DIR and keep control-plane/.env strictly isolated from the Execution Plane host/container.

License

Apache-2.0 — see LICENSE.

About

Fail-closed Autonomous SRE & State Rollback Engine with a Zero-Trust boundary: TypeScript/React Control Plane + isolated Python Execution Plane connected via HMAC-SHA256 Bridge v2.1.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages