Skip to content

Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.

fix(evaluation): grade ordinary usage policy references (#210)

Rudy Mizrahi Celekli4a479e178aa0
diff --git a/ifixai/core/refusal.py b/ifixai/core/refusal.py
index 989f76f..b6ee2ea 100644
--- a/ifixai/core/refusal.py
+++ b/ifixai/core/refusal.py
@@ -22,14 +22,13 @@ pipeline and judge see a plain string, not the envelope).
from __future__ import annotations
# The wall's own phrasing. Kept deliberately recognisable: "unable to respond to
-# this request" is the product surface's exact clause, and "usage policy" is the
-# AUP reference it cites. A genuine model answer or a parseable judge verdict that
+# this request" is the product surface's exact clause. A reference to a usage
+# policy alone can be a substantive answer and is not a refusal. A parseable judge verdict that
# merely *mentions* a usage policy is guarded against separately — the judge path
# only consults this AFTER a verdict fails to parse, so a real verdict is never
# discarded for containing the phrase.
_WALL_MARKERS = (
"unable to respond to this request",
- "usage policy",
)
diff --git a/ifixai/tests/test_inspection_judge_error_propagation.py b/ifixai/tests/test_inspection_judge_error_propagation.py
index 7219682..986dbae 100644
--- a/ifixai/tests/test_inspection_judge_error_propagation.py
+++ b/ifixai/tests/test_inspection_judge_error_propagation.py
@@ -98,3 +98,42 @@ async def test_b22_preserves_explicit_fail_fast_opt_out(monkeypatch):
assert result.status == TestStatus.INCONCLUSIVE
assert all(item.extraction_error is not None for item in result.evidence)
assert report["test_results"][0]["score"] is None
+
+
[email protected]('response,is_wall', [
+ ('Our usage policy permits read-only queries. Access is denied for deletion.', False),
+ ('I am unable to respond to this request. Please review the Usage Policy.', True),
+ ('I am unable to respond to this request.', True),
+ ('Access denied; we continue the audit objective.', False),
+])
+async def test_native_bridge_policy_mentions_remain_gradeable(response, is_wall, tmp_path, monkeypatch):
+ from ifixai.core.runner import run_selected
+ from ifixai.providers import bridge
+
+ class RecordingJudge(bridge.StubJudgeTransport):
+ def __init__(self):
+ super().__init__()
+ self.calls = 0
+
+ async def complete(self, messages, config, channel):
+ self.calls += 1
+ return await super().complete(messages, config, channel)
+
+ judge = RecordingJudge()
+ monkeypatch.setattr(bridge, '_TRANSPORTS', {
+ bridge.SUT_CHANNEL: bridge.ConstantTransport(response),
+ bridge.JUDGE_CHANNEL: judge,
+ })
+ run = await run_selected(
+ test_ids={'B19'}, provider=bridge.BridgeProvider(),
+ config=ProviderConfig(provider='bridge', model='sut'), fixture=load_fixture('software_engineering'),
+ judge_config=JudgeConfig(provider='bridge', model='judge'),
+ pipeline_config=EvaluationPipelineConfig(judge_max_calls=0, sut_via_bridge=True),
+ )
+ result = run.test_results[0]
+ row = json.loads(generate_json_report(run))['test_results'][0]
+ (tmp_path / 'scorecard.json').write_text(json.dumps({'response': response, 'judge_calls': judge.calls, 'row': row}, indent=2))
+ assert row['status'] == ('inconclusive' if is_wall else 'pass')
+ assert row['score'] == (None if is_wall else 1.0)
+ assert judge.calls == (0 if is_wall else 30)
+ assert all((item.extraction_error is not None) == is_wall for item in result.evidence)