Skip to content

feat(guardrails): global checker-down posture toggle (#169) - #181

Merged
JAORMX merged 1 commit into
mainfrom
feat/guardrails-checker-down-toggle-169
Jun 24, 2026
Merged

JAORMX merged 1 commit into
mainfrom
feat/guardrails-checker-down-toggle-169

Conversation

@JAORMX

@JAORMX JAORMX commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What

Adds guardrails.onCheckerDown YAML key (warn default / fail opt-in): when fail, ALL rules treat a checker error/timeout as unsafe (block), unless a rule explicitly sets failClosed. Per-rule failClosed overrides the global (true tightens under warn, false loosens under fail).

Why

Operators had no way to set a global "halt rather than run unguarded" posture without authoring a full rule list with failClosed: true on every rule. The per-rule failClosed knob was too granular for this — and the default advisory rule set carried no failClosed at all.

Changes

  • internal/adapter/modelhook/matcher.go — RuleSpec.FailClosedSet + CompiledRule.failClosedSet (track whether the operator explicitly set failClosed, to distinguish from YAML default false).
  • internal/adapter/modelhook/modelhook.go — Options.FailOnCheckerDown + Runner.failOnCheckerDown; onCheckerError resolves: per-rule explicit wins over global; else global fills in.
  • internal/adapter/permconfig/schema.go — GuardrailsSection.OnCheckerDown YAML key + GuardrailRuleSpec.FailClosedPresent (presence tracking via custom UnmarshalYAML).
  • internal/app/guardrails.go + internal/app/build.go — Config.GuardrailsOnCheckerDown + GuardrailRule.FailClosedSet wiring.
  • ADR 0052 (new). Docs: usage.md, PRODUCTION-READINESS, configuration-reference, skeleton.
  • Tests: three-way matrix (global warn/fail × per-rule set/unset).

Closes #169.

Add guardrails.onCheckerDown YAML key (warn default / fail opt-in): when
'fail', ALL rules treat a checker error/timeout as unsafe (block), unless a
rule explicitly sets failClosed. Per-rule failClosed overrides the global
(true tightens under warn; false loosens under fail). The default (warn) is
byte-identical to the pre-feature behavior.

Resolution in onCheckerError: per-rule explicit failClosed (tracked via
FailClosedSet) wins over the global; else the global fills in. Advisory
rules always fail-open regardless. The failureStreak checker-DOWN
escalation still fires under both postures.

New: guardrails.onCheckerDown YAML key, Config.GuardrailsOnCheckerDown,
Options.FailOnCheckerDown, RuleSpec.FailClosedSet/CompiledRule.failClosedSet,
GuardrailRuleSpec.FailClosedPresent (YAML presence tracking). Decision
recorded in ADR 0052. No engine/port/proto/wire change.

Tests: TestGlobalFailOnCheckerDown, TestGlobalFailOverriddenByExplicitPerRuleWarn,
TestGlobalWarnWithPerRuleFailClosed (the three-way matrix). Existing
failClosed tests updated to set FailClosedSet.

Closes #169.
@JAORMX
JAORMX merged commit 1d9a027 into main Jun 24, 2026
12 of 13 checks passed
@JAORMX
JAORMX deleted the feat/guardrails-checker-down-toggle-169 branch June 24, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

guardrails: add global checker-down posture toggle (warn default / fail opt-in)

1 participant