Addresses review on #359:
- pii / sandbox_escape (and plugins with detects_leak = True) no longer
count as refusal votes. A leak is COMPLIED, or PARTIAL with a refusal.
- Many-shot scan builds the context with unscored warm-up requests, then
always sends the dataset prompt and scores only that reply. Before, it
could score a warm-up reply, and often never sent the attack.
failureRate counted refusals and errors, so a model that refused every
attack scored 100% (grade E, CI fail) and one that complied with every
attack scored 0% (grade A, CI pass).
- process_prompt returns an Outcome (refused/complied/partial/error)
instead of a bool. HTTP errors, request errors, bad JSON, empty
replies and unexpected exceptions are all ERROR.
- failureRate = (complied + partial) / (refused + complied + partial).
Errors are excluded and reported as the new errorRate field.
- Detectors get the reply text, not the stringified JSON envelope.
- Phrase matching ignores case and typographic apostrophes; topic words
(illegal, unethical, OpenAI, Hello!, As an AI) removed from
REFUSAL_MARKS; common refusal phrasings added.
- ml_classifier is off by default and loaded lazily.
- failures.csv now lists findings (complied/partial) with their outcome.
- Mock targets refuse ~80% instead of ~20%, so the demo still passes.
- ConcurrentExecutor trips its circuit breaker on ERROR outcomes.
PIIDetector and SandboxEscapeDetector were wired directly in
probe_actor/refusal.py and the refusal classifier manager was populated from
a hardcoded list, so the only way to toggle a bundled detector or add an
organization-specific signature was to patch the module.
Add a DetectorRegistry mapping plugin names to factories, assembled from an
agentic_security.toml [detectors] section via build_from_config. Custom
detectors load by import path ("pkg.module:ClassName"). refusal.py gains
build_refusal_manager(config=None) reading the [detectors] table; all public
symbols are preserved. Built-in leak detectors ship registered but disabled,
so default refusal_heuristic behaviour is unchanged.
Closes#82
Signed-off-by: Devam Shah <devamshah91@gmail.com>