# BFT runtime path (as traced 2026-10-05)

1. **agent / request** - POST /fabric/try or proxied MCP/REST call (`platform-gateway/main.py`)
2. **governance stages** - identity, policy (OPA), risk, trust, kill switch, ... -> stages[] (`fabric_control_plane.py decide()`)
3. **commitment** - sha256(canonical{decision_id, tenant, principal, agent, service, path, stages, pre_verdict}) (`_consensus_stage`)
4. **fast path (CAIN_AUTH_SNAPSHOT=1)** - ALLOWED + covering quorum-committed snapshot -> no round; leaf queued for Merkle anchor (`governance_runtime.consensus_fast_path`)
5. **deferral** - BLOCKED/REQUIRE_APPROVAL -> ordered after the reply (`_enqueue_deferred_consensus`)
6. **BFT proposal** - op {action: fabric_decision | fabric_decision_batch, commitment} (`cain_mr_client.order_grouped/order_op`)
7. **primary / PRE_PREPARE / PREPARE / COMMIT** - HTTP to replicas on the WireGuard overlay; forwarded to primary (`cluster_api /pbft/request -> HardenedPBFTEngine`)
8. **finality** - 2f+1 COMMITs; replica executes in order: fabric_decision -> READ_OR_POLICY_EVALUATED (no governance check) (`DeterministicStateMachine.apply_operation`)
9. **authorization** - gateway fetches /pbft/qc/{seq}, verifies 2f+1 signatures vs PINNED membership + exact digest (`cain_mr_client.verify_commit`)
10. **post-consensus stages** - egress, tool args, artifacts: restriction-only (`decide()`)
11. **MCPGate / execution** - proxied call executes only if outcome is not blocked (`main.py proxy paths`)

Differences from the prompt's assumed diagram:
- replicas do not evaluate governance or authorization; they order a commitment
- authorization is the gateway's QC verification, not a replica decision
- revocation never goes through BFT (local durable epoch)
- with the fast path, most permits use a snapshot committed earlier

Deployed engine versions:
- cain-mr-01: engine `81bdf841` (HEAD: False)
- cain-mr-02: engine `948b1895` (HEAD: False)
- sandbox (cain-sbx): engine `15d12dab` (HEAD: False)
