Repository navigation
Description
Context
Today, when the guardrail checker model errors, times out, or returns an unparseable verdict, the runner degrades per the rule's failClosed knob (internal/adapter/modelhook/modelhook.go:285, onCheckerError):
- fail-open (default,
failClosedabsent): WARN, content NOT inspected, agent keeps working. - fail-closed (
failClosed: true): treat content as unsafe — Block on Pre / Mutated-to-error on Post.
This is a reasonable degrade, but failClosed is per-rule. The default advisory rule set (authored in code, internal/app/guardrails.go:173) carries no failClosed, so under the default configuration a checker outage means every matched WebSearch/WebFetch/mcp__* call runs unguarded with only a per-call WARN (and the one-time 3-strike "checker DOWN" sticky WARN at guardrailDownThreshold). There is no global "halt when the checker is down" posture — to get it today you'd have to author an explicit rule list with failClosed: true on every rule.
Proposed change
Add a global checker-down posture toggle — a coarse, operator-wide switch for the behavior when the checker model is unavailable (error / timeout / unparseable verdict):
| Value | Behavior on checker error |
|---|---|
warn (default) |
Current fail-open: WARN, content not inspected, agent continues. |
fail |
Current fail-closed: treat content as unsafe (Block on Pre / Mutated-to-error on Post) for all matched rules. |
Wire it as an operator-tier guardrails config key (consistent with the existing operator-tier-only discipline, internal/app/guardrails.go:14 foldOperatorGuardrails), e.g.:
guardrails:
model: deepseek/deepseek-v4-flash
onCheckerDown: fail # default: warn(Exact key name TBD — onCheckerDown, checkerDownPosture, etc. Flag equivalent if useful: --guardrails-on-checker-down=fail.)
Interaction with per-rule failClosed
The global toggle is a default floor; an explicitly-set per-rule failClosed overrides it:
- Global
warn+ rulefailClosed: true→ that rule hard-fails on checker error (per-rule wins). - Global
fail+ rule explicitly opting out (if we add a per-rulefailOpen: true, or reuse the existingfailClosed: falseexplicit) → that rule warns.
Simplest version: per-rule failClosed set explicitly wins over the global; the global fills in for rules that don't set it. This keeps the existing per-rule behavior intact and makes the global a convenience default, not a competing knob.
Scope
- New operator-tier YAML key + CLI flag (if desired).
- Resolution in
onCheckerError(modelhook.go:285): consult the global posture when a rule has no explicitfailClosed. - Update
docs/adr/0021-guardrails.md(Fail-open vs fail-closed section) +docs/architecture.md. - Tests for both postures + the per-rule override.
Out of scope
- The
maxChecks/checkBudgetcall-count cap — that is removed by guardrails: remove maxChecks per-session call-count cap (security footgun) #168. - The
minContentBytes/maxContentBytessize gates — unchanged.
Ref: #168 (companion — remove maxChecks).
Activity
feat(guardrails): global checker-down posture toggle (#169) (#181)