From 6734e8dcb57db29d65049292ccdd1c2e3786a8e8 Mon Sep 17 00:00:00 2001 From: agent-56a7678c6cd71659 Date: Wed, 29 Apr 2026 17:26:12 +0200 Subject: [PATCH] build(agent): jabba#56a767 iteration --- guard_logs.jsonl | 1 + src/guardrail_space/contract.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/guard_logs.jsonl b/guard_logs.jsonl index 3e7fcbc..a9e763e 100644 --- a/guard_logs.jsonl +++ b/guard_logs.jsonl @@ -7,3 +7,4 @@ {"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"} {"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"} {"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"} +{"contract_id": "guard-001", "plan": {"action": "move", "costs": {"time": 2.0}, "speed": 0.8}, "state": {"speed": 0.8, "distance_to_obstacle": 5}, "decision": "allow"} diff --git a/src/guardrail_space/contract.py b/src/guardrail_space/contract.py index 3d5f6c3..30ccbdb 100644 --- a/src/guardrail_space/contract.py +++ b/src/guardrail_space/contract.py @@ -56,11 +56,14 @@ class SafetyContract: def evaluate_pre(self, context: Dict[str, Any]) -> (bool, str): engine = PolicyEngine(self) # Pass a neutral action payload; tests use only context. - return engine.evaluate_pre({"action": None}, context) + ok, _reason = engine.evaluate_pre({"action": None}, context) + # Legacy API expected a boolean result. + return bool(ok) def evaluate_post(self, action: Dict[str, Any], context: Dict[str, Any]) -> (bool, str): engine = PolicyEngine(self) - return engine.evaluate_post(action, context) + ok, _reason = engine.evaluate_post(action, context) + return bool(ok) def to_dict(self) -> Dict[str, Any]: return {