Repository navigation
Conversation
Separate policy-engine dependency unavailability from policy-evaluated refusals (POAM-2026-233 Cause 1 and Consumers 1-3, 7-8, 10, 19):
- Raise PolicyEngineUnavailableError across OPAClient circuit-breaker open, latency-budget bankruptcy, timeout, transport error, HTTP non-2xx, and malformed or undefined Rego replies instead of returning "DENY".
- Emit OPA_UNAVAILABLE with ViolationKind.INFRASTRUCTURE in OpaStage and rank HARD > INFRASTRUCTURE > RELIANCE_INELIGIBLE in ClassificationEngine (InfrastructureOutcome.INFRASTRUCTURE_BLOCK), preserving Phase2Mode.SKIP, immediate pipeline stop, ReservationScope rollback, and zero seal issuance.
- Route INFRASTRUCTURE_BLOCK to handle_infrastructure_block(), hash-chaining unsigned GOVERNANCE_INFRASTRUCTURE_BLOCK operational events and incrementing cage_governance_infrastructure_blocks_total{dependency,code} without constructing RefusalReceipt, calling the KMS signer, incrementing cage_governance_refusals_total, marking the request refused, or triggering auto-quarantine.
- Return typed HTTP 503 (policy_engine_unavailable) with Retry-After and without proof_hash or refusal_receipt on POST /governance/validate-action.
- Align proof/model.py, cage_conformance, Gate 11 producer keys, and golden/unit conformance suites.
BREAKING CHANGE: PolicyClient.evaluate_policy() and OPAClient.evaluate_policy() raise PolicyEngineUnavailableError instead of returning "DENY" on OPA unavailability or malformed/undefined replies; SymbolicGovernor raises GovernanceInfrastructureError (receipt=None) and POST /governance/validate-action returns HTTP 503 policy_engine_unavailable instead of HTTP 403 GovernanceViolation (FA-1 in docs/BREAKING_CHANGES.md).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remediates Cause 1 and Consumers 1–3, 7–8, 10, and 19 of
POAM-2026-233(infrastructure failures recorded as KMS-signed policy refusals) while preserving fail-closed execution blocking across every stage:OPAClient&PolicyClient(src/gateway/core/policy.py,src/gateway/governance/contracts.py): RaisePolicyEngineUnavailableError(instead of returning"DENY") across circuit-breaker open, latency-budget bankruptcy, timeout, transport error, HTTP non-2xx, and malformed or undefined Rego replies.OpaStage&ViolationKind.INFRASTRUCTURE(src/gateway/governance/governor/stages/opa.py,src/gateway/governance/classification_engine.py,src/gateway/governance/governor/pipeline.py): EmitOPA_UNAVAILABLEwithViolationKind.INFRASTRUCTURE, rankHARD > INFRASTRUCTURE > RELIANCE_INELIGIBLE > ...(InfrastructureOutcome.INFRASTRUCTURE_BLOCK), and preservePhase2Mode.SKIP, immediate pipeline stop,ReservationScoperollback, and zero seal issuance.handle_infrastructure_block()(src/gateway/governance/governor/verdicts.py,src/gateway/governance/governor/governor.py,src/gateway/governance/governor/metrics.py,src/gateway/governance/governor/errors.py): Hash-chain unsignedGOVERNANCE_INFRASTRUCTURE_BLOCKoperational events and incrementcage_governance_infrastructure_blocks_total{dependency,code}without constructingRefusalReceipt, calling the KMS signer, incrementingcage_governance_refusals_total, callingmark_request_refused(), or dispatching auto-quarantine; raiseGovernanceInfrastructureError(receipt=None).POST /governance/validate-action(src/gateway/server/governance_middleware.py): Return typed HTTP503({"error": "policy_engine_unavailable", "dependency": "opa", "failure_code": "OPA_UNAVAILABLE", "retry_after_seconds": 5}) withRetry-After: 5and noproof_hashorrefusal_receipt.proof/model.py,packages/cage-conformance/,scripts/check_producer_consumer_keys.py, golden verdict vectors, andFA-1indocs/BREAKING_CHANGES.md. (POAM-2026-233remainsOpenfor the remaining enumerated causes and consumers.)Breaking Change
BREAKING CHANGE:PolicyClient.evaluate_policy()andOPAClient.evaluate_policy()raisePolicyEngineUnavailableErrorinstead of returning"DENY"on OPA unavailability or malformed/undefined replies;SymbolicGovernorraisesGovernanceInfrastructureError(receipt=None) andPOST /governance/validate-actionreturns HTTP503(policy_engine_unavailable) instead of HTTP403(GovernanceViolation). Recorded asFA-1indocs/BREAKING_CHANGES.md.Verification
CAGE_DEPLOYMENT_REGION=US_FED uv run pytest tests/unit/test_opa_unavailability_fail_closed.py tests/test_gateway_core_policy.py tests/test_violation_kinds.py tests/test_opa_client.py tests/test_symbolic_governor.py tests/test_distributed_cbf_proof.py tests/test_governance_trace_conformance.py tests/test_cage_conformance.py tests/governor/ -q-> 1,040+ passed, 0 failed (plus full-m "local or unit"sweep: 11,944 passed, 0 failed)uv run bandit -r src/ scripts/ -c pyproject.toml -ll -ii-> 143,705 lines scanned, 0 Medium / 0 High issuesuv run python scripts/check_producer_consumer_keys.py --verbose&uv run python scripts/check_doc_references.py-> pass (0 errors)