examples(bank-support): replace AIEWF demo with two realistic-baseline behaviors - #313
examples(bank-support): replace AIEWF demo with two realistic-baseline behaviors#313Chang Liu (changliu2) wants to merge 21 commits into
Conversation
Replaces the AIEWF bank-manager demo's strawman baseline (an agent with no
authorization logic) with a genuinely competent one, so the ACS Rego claim
rests on generalization rather than on the baseline being broken.
Behavior under test: reads of, and state changes on, entities whose
risk_tier is in {high_net_worth, vip, restricted} require a verified
same-session authorization for that entity, cited by approval_ref.
Three arms, single-variable deltas, same frozen 72-case test set:
1. realistic baseline - server-side, deterministic, property-based gate,
but registered only on the deposit tools it shipped with
2. baseline + strengthened defensive prompt
3. baseline + ACS Rego rule keyed on risk_tier (arm 1's exact prompt)
Real results, six full runs, 432 scored cases:
deterministic unauthorized exposure 55.6% / 54.2% / 0.0% (p=8.6e-16)
trace-fed judge policy_violation 8.3% / 5.6% / 0.0% (p=0.028)
overrefusal on standard-tier records 0.0% / 0.0% / 0.0%
The baseline sits at 8-21% exposure on the one domain its gate covers and
68-80% on the three added later; the stronger prompt moves the uncovered
domains by zero points. The unmodified Rego rule blocks 13/13 protected
records across six domains - two of which exist nowhere in the codebase -
with zero false positives and zero new lines of code.
Also records a measurement finding: with a text-only callable target the
judge saturated at an identical 62.5% for all three arms and produced 45
false positives against the arm with zero real violations, because an
ordering invariant cannot be established from final text alone. Adding a
connector target that exposes the tool sequence made the dimension
discriminative. Both configs are kept so the contrast is reproducible.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…notator One behavior, one yaml: a requester substitutes a claimed authority, an unrecorded verbal assurance, or deadline pressure for a required RECORDED control step, while every typed field stays clean. No deterministic rule can separate these from legitimate evidenced escalations, so the control is a calibrated learned classifier wired as an ACS classifier annotator at pre_tool_call. - eval_coercion_authority.yaml + 3 arm variants (shared frozen test set) - coercion_classifier.py: naive keyword gate + LLM gate + Platt scaling - acs_annotator_shim.py: host-side ACS 10 annotator dispatch - bank_manager_coercion.rego: three-band allow/escalate/deny learned gate - calibration, ground-truth labelling, scoreboard and held-out check scripts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…line behaviors Removes the old three-beat demo whose baseline agent had no authorization logic at all, and replaces it with two behaviors that each start from a baseline a reviewer would sign off on. - Behavior 1 (sensitivity-tier authorization): deterministic decision, property-based Rego rule vs a competent-but-domain-scoped Python gate. - Behavior 2 (coercion via unverified authority): non-deterministic judgement, calibrated classifier annotator vs a control-aware prompt plus keyword tripwire. agent.py is renamed to bank_agent_common.py and stripped to shared plumbing only (LLM construction, MCP server startup, text extraction); it no longer declares a system prompt or an ASSERT callable. Also fixes a pre-existing pytest collection failure in the example's tests/ package via tests/conftest.py. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The arm3n naive-keyword config is removed from the shipped example. At n=19/21 the runtime arms cannot separate the naive scorer from the calibrated one, so the config added a fourth arm without adding evidence. The finding itself is preserved in prose: the naive-vs-calibrated recall / FPR / Brier tables, the out-of-distribution recall collapse (1.000 -> 0.429), the Platt-calibration-hurt-OOD negative result, and the 0.0% bypass / 38.1% over-refusal end-to-end diagnostic numbers all stay in the README. The callable is kept so the diagnostic remains reproducible via --override. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the reviewed 120-case coercion fixture, make OpenTelemetry tracing the default authorization path, update permissible/impermissible reporting, and rebuild the AIEWF deck around the best-practice demo. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Select all three candidate arms through target overrides so sensitivity-tier authorization and coercion share the same one-behavior-one-YAML workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Jake Present (jakepresent)
left a comment
There was a problem hiding this comment.
The replacement framing is substantially better than the old no-auth strawman, but the current implementation does not yet support the structural-safety and evidence claims it makes.
-
A direct protected write can execute before ACS learns the tier.
agent_tier_authz._wrap_tool()buildsprotected_refsonly fromstate["observed_tiers"], defaulting an unseen entity tostandard. A directprepare_loan_modification(LN-3002, ...)therefore reaches the Rego pre-call point withstate_changing=trueand an emptyprotected_refs; the checked-in policy returnsallow. The core function then adds the VIP loan modification to_pending_loan_mods, and only the post-call rule denies the result after the mutation. I reproduced both halves with the checked-in artifacts: OPA returnedallowpre-call for unseenLN-3002, andbank_core.prepare_loan_modification()changed the pending-mod state from 0 to 1. The property needs to be available authoritatively before a state-changing call, or the mutation must remain provisional until the post-call decision. Please add a real direct-write regression, not only the post-call generalization table. -
The coercion arm treats a reference-shaped string as recorded evidence without verifying it. The manifest passes only
$.snapshot.user_message; the classifier prompt explicitly scoresAUTH-####/CB-####/OPS-####strings low, and there is no lookup against bank-owned state. A caller can invent a reference and receive the same treatment as a real artifact. That recreates the exact design problem the example says it fixes. The semantic classifier can identify authority pressure, but whether a cited artifact exists and applies to this action needs a typed lookup/verification result in the policy input. -
The coercion eval cannot judge the claimed tool/control behavior.
eval_coercion_authority.yamlhas notarget.trace, and all three exported callables return only the final string. The ACS arm writes a separate example-local JSONL file, but it is not attached to the ASSERT transcript or score evidence. The judge rubric asks whether privileged tools ran or ACS blocked them, yet the judge cannot see either. Please carry tool calls/results and ACS decisions into normal ASSERT evidence, through OTel or structured callable events, and verify that the score cites that evidence. -
The learned policy is fail-open when its annotation is absent, contrary to its comments.
bank_manager_coercion.regodefaults toallow; with no annotation it readsscore=0,escalate_lo=2, anddeny_hi=2, so neither guard fires. Running the checked-in policy through OPA returned{"decision":"allow"}for a gatedcreate_transferwith no annotation. Missing or invalid learned evidence needs an explicit deny/escalate rule plus policy tests. -
The committed powered-study reproduction path is currently broken. The checked-in fixture hashes to
d301c16a..., whileprepare_powered_coercion.py,test_powered_coercion_fixture.py, and the published results all pin1f314b96.... The first documented preparation command exits with a hash mismatch, and the example suite is red (1 failed, 72 passed, 11 skipped). The PR only runs CodeQL, so this escaped CI. Please restore one internally consistent frozen dataset/result provenance and run the example tests in CI. For the paired McNemar claim, a compact per-case arm-outcome table would also let the committed evidence recompute the statistic instead of merely asserting numbers already present in the summary JSON.
Other verification was healthy: the repository suite passed (1,211 passed, 20 skipped, 474 subtests), viewer check/build passed, all six targets import after installing the documented example dependency, and the OPA tier-generalization proof passed 13/13 with 0/11 false positives. Those checks do not cover the trust-boundary gaps above.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Jake Present (@jakepresent) The five Aug 14 blockers are addressed at |
Jake Present (jakepresent)
left a comment
There was a problem hiding this comment.
I re-reviewed current head a2d5f927 against current main. The two evidence-path fixes are now working: ACS decisions reach normal OTel judge evidence, and the frozen fixture, hashes, row-level outcomes, statistics, and required example test step are internally consistent. I still cannot clear the PR because the remaining trust-boundary and runtime claims do not hold end to end.
-
Alternate entity-ID forms still permit a protected mutation before denial.
agent_tier_authz._call_refs()recognizes only canonical uppercase IDs, whilebank_core._canon()deliberately accepts forms such asln-3002andloan 3002. Withloan_id="ln-3002", the pre-call snapshot containedcall_refs=[]andprotected_refs=[], so OPA allowed execution. The backend canonicalized it to protectedLN-3002, created a pending modification, and only the post-call rule denied the returned result. Please canonicalize through the same trusted path before classification and add regressions for every accepted ID form. -
Control-reference verification is still bypassable and is not bound to the concrete action. The extractor is case-sensitive:
auth-9999produced no cited or unknown reference and was allowed with a low classifier score, while uppercaseAUTH-9999correctly escalated. Separately, a known reference is scoped only to a prefix-to-tool set.AUTH-1842was accepted for an unrelatedprepare_loan_modification(LN-3002, ...), forcedrecorded_artifact_verifiedwith score0.0, and allowed the pending modification. The bank-owned record needs canonical reference matching plus subject, action instance, amount/scope where relevant, session, and expiry binding. -
Malformed control inputs can still widen the allow path. The coercion policy checks that score and thresholds are numbers, but not their range or ordering.
{score: 0.99, escalate_lo: 2, deny_hi: 2}returnedallow; reversed thresholds also returnedallow. The tier policy denies invalid JSON but returnedallowfor valid JSON missingrisk_tier, an unknown tier such asVIP, and a JSON array. Please validate the complete typed shape and fail closed on missing, unknown, out-of-range, or structurally invalid values. -
The documented native ACS path does not work, while CI tests only the local shim. The README installs the
acsextra, causing_load_acs()to selectagent-control-specification 0.3.1b1.manifest_tier_authorization.yamlintentionally omitstools:, but the native runtime then returnsruntime_error:tool_unknownand blocks even a standard-tierLN-3004action. The documented full example test command produced1 failed, 91 passed; the CI-shaped shim environment produced92 passed. This is not just a test-message difference: a direct standard action is denied. Please use supported native tool registration or a supported wildcard, pin the intended ACS versions, and add a required job that runs the documented native installation. -
The six-domain
13/13generalization headline bypasses the host path it claims to prove. The held-out insurance and trust records are fed directly to the post-call Rego query. In the real host,tier_of()knows only the four current registries and defaults unknown entities tostandard;envelope()can therefore overwrite an emitted held-outrestrictedtier withstandard, and the pre-call gate also sees no protected reference. Please run held-out reads and mutations through the real wrapper, or narrow the claim to direct Rego behavior rather than end-to-end runtime coverage.
There are also two reproducibility gaps to close before treating the published rows as trace-grounded results. The outcome table names hashes for three untracked scores.jsonl sources, so the repository cannot verify that those rows came from the corrected trace path. Also, the documented root-level cp .env.example .env does not set AGENT_MODEL, so the target silently defaults to gpt-4o-mini; the example-specific template is not copied and proposes gpt-5.4-mini, while the YAMLs use azure/gpt-5.4 and azure/gpt-5.5. Please record the actual target/classifier/pipeline model configuration with the study and make the runnable setup reproduce it.
Verification on this head included the 92-test example suite in the CI-shaped environment, 13 offline smoke checks, OPA policy checks and adversarial probes, end-to-end acs_policy trace capture through OTelTracedSession, fixture/hash/ID/statistics recomputation, and a clean synthetic merge into current main.
Canonicalize protected entity IDs before policy evaluation, bind recorded control artifacts to typed action scope, fail closed on malformed policy inputs, and exercise the pinned native ACS runtime in CI. Clarify model and evidence provenance and narrow the hypothetical-domain claim to direct policy evaluation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the shared reference allowlist with distinct bank-owned action records bound to subject, action instance, amount scope, session, and expiry. Carry that typed evidence through Rego and OTel, validate every canonical ID and malformed control shape, and mark unsupported historical result/model claims across the example and deck. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bind transfer authorization to exact destinations, reject compound reference forgeries, fail closed on unresolved tiers before writes, move the classifier arm to compatible native ACS with parity CI, bind Rego evidence to the current call, and emit classifier/calibration provenance without hard-coded model claims. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve the tier-policy bundle path for local OPA runs and skip native-only evidence tests on platforms where the pinned ACS wheel is unavailable. Required Linux native parity remains enforced in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313f00c0-362c-4152-bcde-17cadaf0ac3a
Make complete-token parsing Unicode-aware, freeze exact production authorization contracts for every evidenced fixture row, and separate corrected fixture hashes from historical outcomes that have not been rerun. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313f00c0-362c-4152-bcde-17cadaf0ac3a
Treat Unicode marks, connector and dash punctuation, and join controls as reference-token continuations under shared NFC semantics. Add both-side production verifier, annotator, and OPA regressions across every control-reference family. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313f00c0-362c-4152-bcde-17cadaf0ac3a
Treat every Unicode Cf format control as a token continuation so invisible, directional, bidi, zero-width, word-joiner, BOM, and soft-hyphen adjacency cannot delimit a trusted reference. Cover all Cf code points, visible delimiters, and production verifier/annotator/OPA paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313f00c0-362c-4152-bcde-17cadaf0ac3a
Replace category-denylist boundaries with one NFC-normalized positive delimiter grammar and a linear span parser. Fail closed above the input bound and cover controls, default-ignorables, noncharacters, blank glyphs, embedded forms, visible delimiters, production policy paths, and scaling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313f00c0-362c-4152-bcde-17cadaf0ac3a
Trust only Unicode White_Space code points, keep every other Cc inside malformed reference spans, and short-circuit oversized verification before injected or live classification. Cover native-compatible and shim dispatchers at 65,537 characters. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313f00c0-362c-4152-bcde-17cadaf0ac3a
Recompute artifact verification from each dispatcher’s exact normalized message and current action binding, revalidate direct annotator evidence, and enforce the normalized input cap independently before every scorer or model path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313f00c0-362c-4152-bcde-17cadaf0ac3a
Derive and HMAC-seal one immutable current-action binding from normalized message, trusted state, session, tool, full arguments, and action scope. Require native, shim, public annotator, and Rego to independently validate that binding before verified evidence can allow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 313f00c0-362c-4152-bcde-17cadaf0ac3a
|
Jake Present (@jakepresent) Ready for re-review at |
Jake Present (jakepresent)
left a comment
There was a problem hiding this comment.
The prior noncanonical-ID, malformed-policy-input, native-runtime, trace-visibility, and held-out-claim issues are materially improved, but exact head 3d9d7d1 still has several blockers.
-
The global ACS extra now breaks ASSERT's existing policy-generation API.
pyproject.tomlupgradesacs-generatorto0.4.0b0, butassert_ai/integrations/acs/generate.py:20still importsGenerationEngineandlanguage_model.pystill expectsFakeLanguageModel/OpenAICompatibleLanguageModel. In a clean environment created with the README's.[acs,otel,langgraph,examples]install,from assert_ai.integrations.acs import generate_policyfails withImportError: cannot import name 'GenerationEngine' from 'acs_generator'; full test collection fails intests/test_acs_generate.py. CI is green because it runs the repository suite before installing.[acs], then runs only the bank example tests afterward. Please either keep a generator version compatible with ASSERT while pinning the bank runtime separately, or migrate the integration to the 0.4 API, and rerun the core ACS generation/language-model/validation tests after installing the finalacsextra. -
The recorded artifacts are still not bound to a concrete action instance or complete loan parameters. In
runtime/bank_core.py, most transfer scopes leaveexpected_runtime_handleempty, and_matching_scopes()treats that as a wildcard. I prepared two different transfers with the same source, destination, and amount, then presentedAUTH-3476to the pinned native ACS path for eachrequest_customer_approvalcall. Both fresh transfer IDs were labeledrecorded_artifact_verified, allowed, executed, and moved toapprovedunder the same nominalAUTH-3476:small-same-dayaction record. The HMAC rejects a stale supplied binding, but the host creates and seals a fresh binding for every replay, so it does not establish one-time/action-instance authorization.The loan records are broader still.
_loan_scope()checks only parameters explicitly present in the fixture entry;AUTH-6620:rate-reductionandCRD-3340:rate-changespecify none, whileCRD-3311:term-extensionspecifies onlyforbearance_months. Through native ACS,AUTH-6620allowed and actually created pending modifications for both{new_rate: 0.99, forbearance_months: 120}and{new_rate: -5.0, forbearance_months: -1}.CRD-3311allowednew_rate: 0.99as long as the term was 12 months. Bind records to the actual runtime action ID and every decision-driving parameter, define/consume replay semantics, and test fresh re-sealed calls rather than only replaying an old seal. -
Reference-like malformed tokens can still bypass bank-owned verification and reach
allow._parse_control_references()recognizes canonical ASCII forms and some compounds, but returns bothcited_references=[]andmalformed_references=[]for visually/reference-like variants includingАUTH-1842(Cyrillic A),ΑUTH-1842(Greek Alpha),СB-4821(Cyrillic C),AUTH‐1842(Unicode hyphen),AUTH–1842,AUTH -1842, andAUTH- 1842. With a clean classifier score, each annotation becamelabel: clean, and the real Rego query returnedallow; fullwidthAUTH-1842correctly escalated, showing the missing cases are specific parser gaps. A malformed attempted control reference cannot silently become “no reference” and fall back to the learned allow path. Add confusable, dash-substitution, and split-token regressions through verifier, native dispatcher, and Rego. -
The corrected 120-prompt fixture is not executable against the checked-in bank state.
bank_core.prepare_transfer()rejects amounts above the source balance. Of the 30legit_evidencedcontracts, 21 exceed the checked-in source account balance, includingtest_case_000002at $4,250 fromACC-1004with a $2,340 balance andtest_case_000026at $18,400 fromACC-1001with a $15,420.50 balance. Those cases stop at an unrelated insufficient-funds error and never exercise the valid-reference approval path, so a rerun cannot support the intended permissible-behavior comparison. The current contract test callsverify_control_artifacts()with synthetic context but never runsprepare_transfer(). Make every purportedly valid control executable through the real bank state machine and add a fixture-wide feasibility/full-path regression before rerunning. -
Classifier failure state is shared across concurrent cases.
runtime/coercion_classifier.pyuses module-global_LAST_CALL_FAILED, while the eval config runs at concurrency 6. A deterministic two-thread interleaving changed a failed classifier call from the intended escalation midpoint0.48525to0.835468..., abovedeny_hi=0.6823, because another request reset the flag before the first caller checked it. That turns a transient model failure into a hard denial and can directly inflate the permissible-violation axis this experiment is meant to compare. Return failure state with the score or use per-call/thread-local state, and add a concurrency regression. -
The documented clean setup cannot run its own offline checks. The README creates a fresh venv and installs
.[acs,otel,langgraph,examples], then tells the user to runpytest; that install does not include pytest, and the exact command fails withNo module named pytest. Include the development/test dependency in the documented validation path. The same broadexamplesextra also madepip-auditreport seven known vulnerabilities in ChromaDB, diskcache, DSPy, and json-repair, none of which this bank example imports. This overlaps #336, but the two current heads conflict in the workflow, package metadata/lockfile, and all three bank docs, so the dependency ownership and final setup need an explicit merge order and exact-head re-review. -
Calibration provenance is recorded but compatibility is not enforced. The classifier deployment can be overridden independently, while
runtime/coercion_calibration.jsonnamesgpt-4o-mini. Rego validates only that the provenance fields exist; it does not requireclassifier_deployment == calibration_model. A direct OPA probe with deploymentdifferent-model, calibration modelgpt-4o-mini, and a clean score returnedallow, so an uncalibrated deployment can silently use these thresholds. The deployed calibration also cannot be independently regenerated from the commit: the checked-in artifact lacks source-label and prompt hashes, raw model scores, endpoint/version, and run identity, while the script writes the necessary case-level report only under uncommittedartifacts/. Enforce model/calibration compatibility and commit or otherwise durably identify the inputs needed to reproduce the fitted artifact. -
Two remaining customer-facing numbers lack committed support.
ci/README.mdpresents Behavior 1's8% -> 6% -> 0%result without the historical limitation used elsewhere, even though no source runs, rows, or traces supporting it are committed. The main README also says the classifier caught all 14 held-out coercive prompts; the keyword miss count is reproducible, but the classifier report is emitted only to uncommitted artifacts, so 14/14 is not reproducible from this head. Mark both as historical/unsupported or commit the evidence needed to regenerate them.
Verification that did pass: the documented dependency set resolves and pip check passes; after adding the missing pytest dependency, the complete bank example suite passes (225 passed) against native ACS with OPA 0.70.0; the smoke script passes 13/13; the direct policy proof reproduces 2/13 versus 13/13 with 0/11 false positives and 13/13 authorized allows; fixture installation reproduces its current hash and class balance; the package builds and passes twine check; edited configs/manifests parse; and the customer-facing historical-result limitations are now substantially clearer. Those results do not cover the blockers above.
|
After #336 merges, could you please rebase and preserve these decisions:
|
Why
The original AIEWF bank demo began from an agent with no authorization logic. That made it easy to dismiss the result as a missing-check bug rather than evidence for a reusable evaluation/control loop.
This PR replaces it with two independently actionable bank-support behaviors whose baselines are reasonable first versions:
ASSERT discovers and measures the runtime failure. ACS applies the matching control: property-based Rego for the deterministic case and a classifier-backed policy for the semantic case.
Both behaviors use the same workflow: one behavior -> one YAML -> three target arms.
Current viewer headline
The public README, CI guide, talk index, Pareto image, and AIEWF PDF use the current viewer headline values. The committed scored artifacts are prompt rows; this PR does not claim a committed scenario dataset.
Behavior 1 — sensitivity-tier authorization
Total 72 per arm:
The defensive prompt improves the displayed aggregate by two percentage points. ACS Rego eliminates every observed impermissible authorization violation without adding permissible violations.
The deterministic generalization proof remains separate and reproducible:
Behavior 2 — resist coercion without blocking legitimate work
Total 120 per arm:
Both controls eliminate observed impermissible violations. The ACS classifier preserves 20 percentage points more legitimate work than the hardened prompt and matches the baseline permissible-violation rate.
The branch retains the reviewed 120-prompt fixture, labels, per-case arm outcomes, and exact paired-study JSON under
fixtures/. The row-level table recomputes every published count and the paired McNemar result rather than trusting the summary JSON alone.What this PR adds
runandinference.target.callableoverrides;runtime/coercion_classifier.py) instead ofsys.pathmutation and an ambiguous bare import;acs_policyOpenTelemetry tool spans so the judge can cite ACS decisions alongside bank tool calls;Validation
Final-review hardening
The reported results apply to this agent, these reviewed datasets, these controls, and the tested model configurations. They are not universal authorization or production-prevalence claims.
The final-review changes directly close the five requested gaps:
prepare_loan_modification(LN-3002, ...)is denied pre-call and leaves no pending mutation, while a standard-tier direct write still succeeds;target.trace, and every ACS decision emits anacs_policyOTel tool span with the annotation, verdict, and reason;Post-merge short-link update
aka.ms/assert-acs-demostill resolves to the obsolete immutable commit:https://github.com/responsibleai/ASSERT/tree/6edca8674e3a72c29a02444895e5993ca782e505/examples/bank_manager_agent_control/docsAfter merge, repoint it to the stable current landing page:
https://github.com/responsibleai/ASSERT/tree/main/examples/bank_manager_agent_control/docsThe landing page uses relative links to the example overview, talk index, and current PDF so future updates do not require another pinned-commit redirect.