feat(redteam): add detection-to-action smoke benchmark#3362
feat(redteam): add detection-to-action smoke benchmark#3362kerberosmansour wants to merge 4 commits into
Conversation
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
🤖 AI Agent: code-reviewer — Action items:
TL;DR: 0 blockers, 2 warnings. The PR introduces a well-structured and security-conscious red-team smoke benchmark, but there are minor areas for improvement.
Action items:
Warnings (fine as follow-up PRs):
|
🤖 AI Agent: security-scanner — View details
No security issues found. |
🤖 AI Agent: docs-sync-checker — Docs Sync
Docs SyncDocumentation is in sync. |
🤖 AI Agent: test-generator — `tests/redteam/benchmark/benchmark.py`
|
🤖 AI Agent: breaking-change-detector — API Compatibility
API CompatibilityNo breaking changes detected. |
|
🟡 Contributor Check: MEDIUM
Automated check by AGT Contributor Check. |
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
- contract.schema.json <-> benchmark.py drift test still missing: the existing schema test only checks $defs names, additionalProperties:false, and the certification const; nothing cross-checks the schema's required/properties against SCENARIO_FIELDS/TRACE_FIELDS/RESULT_FIELDS/REPORT_FIELDS, so the two sources of truth can drift silently.
- one-line phase-2 note in tests/redteam/benchmark/README.md that detection_verdict is declared scenario metadata (live detection = phase 2); a real detector catching an evasion would currently be a contract violation.
- (process) MAINTAINER: approve the fork workflow runs; the PR's own redteam-benchmark.yml has never executed in CI (local equivalent passes: 18 tests + 4 subtests incl e2e smoke).
Signed-off-by: kerberosmansour <13433538+kerberosmansour@users.noreply.github.com>
|
Addressed in
Local validation now passes with 19 contract tests, including the four schema-definition subtests, plus the end-to-end smoke run, Ruff formatting/lint, Python compilation, and diff checks. The fork workflow approval remains a maintainer-only process step, as noted in the review. |
Summary
Adds the first accepted phase of the evidence-led red-team benchmark proposed in #3349:
tests/redteam;detected/executedandundetected/containedvisible;agt red-teampath.The smoke gate fails on executed attacks, benign false blocks, benign detector flags, contract violations, evidence-level overclaims, raw/secret-bearing artifacts, or certification claims. It does not produce a single aggregate resilience score.
Issue and accepted scope
Refs #3349.
This implements the initial scope supported in the maintainer feedback:
#3349 (comment)
The public CLI,
agent-srelive execution support, 240-scenario measurement suite, external 54k corpus, and 250-record live tier remain deferred for separate review.Follow-up hardening
Cross-platform and evidence-integrity review of the reference implementation led to a small hardening pass in this PR:
propertiesandrequiredfields are checked bidirectionally against the four Python record-field constants, preventing contract drift;detection_verdictis declared scenario metadata in this phase and real detector output is phase-two work;The corresponding reference implementation fixes are in kerberosmansour/AGT-Embeddings-Experiment#42. They distinguish an observed model refusal from incomplete live trace capture, remove import-time fixture loading, and document/guard generated corpus tests.
This AGT contribution remains intentionally L2-only. It does not port the live or corpus tiers.
Validation
python3 -m unittest discover -s tests/redteam -p 'test_benchmark_contract.py' -v— 19 tests passed, including the four schema-definition drift subtests, both executed-attack matrix subtests, and the fail-closed input/hygiene regressions.bash tests/redteam/benchmark/run-smoke.sh— 24 scenarios validated; matrix6 detected/contained, 0 detected/executed, 6 undetected/contained, 0 undetected/executed; 12/12 benign cases allowed; hygiene passed.python3 -m ruff format --check ...— passed.python3 -m ruff check ... --select E,F,W --ignore E501— passed.python3 -m py_compile ...— passed.actionlint .github/workflows/redteam-benchmark.yml— passed.shellcheck tests/redteam/benchmark/run-smoke.sh— passed.The existing
tests/redteam/test_asi.pyremains unchanged. Its 84 tests collect successfully; executing them on currentmainis independently blocked by their existing reference to the absenttemplates/policies/starters/*fixture path.Security and evidence boundary
L2_mock_behaviouralandcertification_claim: false.executedmeans a benign dry-run completed inside the mock harness; every trace recordsside_effects: none.Compatibility
This is additive test and CI coverage. It does not change packages, runtime governance behavior, existing playbooks, existing red-team tests, or the public CLI.
Prior art
The contract, evidence levels, and attempted-versus-executed trace semantics are adapted from the MIT-licensed reference implementation: