Skip to content

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

Description

@JAORMX

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, failClosed absent): 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 + rule failClosed: true → that rule hard-fails on checker error (per-rule wins).
  • Global fail + rule explicitly opting out (if we add a per-rule failOpen: true, or reuse the existing failClosed: false explicit) → 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 explicit failClosed.
  • 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

Ref: #168 (companion — remove maxChecks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions