Repository navigation
feat(guardrails): global checker-down posture toggle (#169) - #181
Merged
Merged
Conversation
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.
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.
What
Adds
guardrails.onCheckerDownYAML key (warndefault /failopt-in): whenfail, ALL rules treat a checker error/timeout as unsafe (block), unless a rule explicitly setsfailClosed. Per-rulefailClosedoverrides the global (truetightens underwarn,falseloosens underfail).Why
Operators had no way to set a global "halt rather than run unguarded" posture without authoring a full rule list with
failClosed: trueon every rule. The per-rulefailClosedknob was too granular for this — and the default advisory rule set carried nofailClosedat all.Changes
internal/adapter/modelhook/matcher.go—RuleSpec.FailClosedSet+CompiledRule.failClosedSet(track whether the operator explicitly setfailClosed, to distinguish from YAML default false).internal/adapter/modelhook/modelhook.go—Options.FailOnCheckerDown+Runner.failOnCheckerDown;onCheckerErrorresolves: per-rule explicit wins over global; else global fills in.internal/adapter/permconfig/schema.go—GuardrailsSection.OnCheckerDownYAML key +GuardrailRuleSpec.FailClosedPresent(presence tracking via customUnmarshalYAML).internal/app/guardrails.go+internal/app/build.go—Config.GuardrailsOnCheckerDown+GuardrailRule.FailClosedSetwiring.Closes #169.