77from agent_control .evaluation import _ControlAdapter , _merge_results
88from agent_control .evaluation_events import (
99 build_control_execution_events ,
10- deliver_oss_events ,
10+ enqueue_observability_events ,
1111 map_applies_to ,
1212)
1313from agent_control .telemetry .trace_context import (
@@ -183,7 +183,7 @@ def test_composite_control_uses_representative_observability_identity(self):
183183 assert event .metadata ["all_evaluators" ] == ["regex" ]
184184 assert event .metadata ["all_selector_paths" ] == ["input" , "output" ]
185185
186- def test_deliver_oss_events_uses_existing_batcher (self ):
186+ def test_enqueue_observability_events_uses_existing_batcher (self ):
187187 from agent_control_models import ControlExecutionEvent
188188
189189 events = [
@@ -203,7 +203,7 @@ def test_deliver_oss_events_uses_existing_batcher(self):
203203
204204 with patch ("agent_control.evaluation_events.is_observability_enabled" , return_value = True ), \
205205 patch ("agent_control.evaluation_events.add_event" ) as mock_add :
206- deliver_oss_events (events )
206+ enqueue_observability_events (events )
207207
208208 mock_add .assert_called_once_with (events [0 ])
209209
@@ -253,7 +253,7 @@ async def test_delivers_local_events_in_oss_mode(self):
253253
254254 with patch ("agent_control.evaluation.ControlEngine" , return_value = mock_engine ), \
255255 patch ("agent_control.evaluation.list_evaluators" , return_value = ["regex" ]), \
256- patch ("agent_control.evaluation.deliver_oss_events " ) as mock_deliver :
256+ patch ("agent_control.evaluation.enqueue_observability_events " ) as mock_enqueue :
257257 result = await evaluation .check_evaluation_with_local (
258258 client = client ,
259259 agent_name = "agent-000000000001" ,
@@ -265,8 +265,8 @@ async def test_delivers_local_events_in_oss_mode(self):
265265 event_agent_name = "test-agent" ,
266266 )
267267
268- mock_deliver .assert_called_once ()
269- delivered_events = mock_deliver .call_args .args [0 ]
268+ mock_enqueue .assert_called_once ()
269+ delivered_events = mock_enqueue .call_args .args [0 ]
270270 assert len (delivered_events ) == 1
271271 assert delivered_events [0 ].trace_id == "abc123"
272272 assert delivered_events [0 ].span_id == "def456"
@@ -275,9 +275,20 @@ async def test_delivers_local_events_in_oss_mode(self):
275275
276276 @pytest .mark .asyncio
277277 async def test_resolves_provider_trace_context_for_local_events (self ):
278- from agent_control_models import EvaluationResponse , Step
278+ from agent_control_models import ControlMatch , EvaluationResponse , EvaluatorResult , Step
279279
280- mock_response = EvaluationResponse (is_safe = True , confidence = 1.0 )
280+ mock_response = EvaluationResponse (
281+ is_safe = True ,
282+ confidence = 1.0 ,
283+ non_matches = [
284+ ControlMatch (
285+ control_id = 1 ,
286+ control_name = "test-ctrl" ,
287+ action = "allow" ,
288+ result = EvaluatorResult (matched = False , confidence = 0.1 ),
289+ )
290+ ],
291+ )
281292 mock_engine = MagicMock ()
282293 mock_engine .process = AsyncMock (return_value = mock_response )
283294 controls = [{
@@ -300,7 +311,7 @@ async def test_resolves_provider_trace_context_for_local_events(self):
300311
301312 with patch ("agent_control.evaluation.ControlEngine" , return_value = mock_engine ), \
302313 patch ("agent_control.evaluation.list_evaluators" , return_value = ["regex" ]), \
303- patch ("agent_control.evaluation.deliver_oss_events " ) as mock_deliver :
314+ patch ("agent_control.evaluation.enqueue_observability_events " ) as mock_enqueue :
304315 await evaluation .check_evaluation_with_local (
305316 client = client ,
306317 agent_name = "agent-000000000001" ,
@@ -309,7 +320,7 @@ async def test_resolves_provider_trace_context_for_local_events(self):
309320 controls = controls ,
310321 )
311322
312- delivered_events = mock_deliver .call_args .args [0 ]
323+ delivered_events = mock_enqueue .call_args .args [0 ]
313324 assert delivered_events [0 ].trace_id == "a" * 32
314325 assert delivered_events [0 ].span_id == "b" * 16
315326
@@ -500,7 +511,7 @@ async def test_merged_event_sink_emits_reconstructed_local_and_server_events_onc
500511 patch ("agent_control.evaluation.list_evaluators" , return_value = ["regex" ]), \
501512 patch ("agent_control.evaluation.has_control_event_sink" , return_value = True ), \
502513 patch ("agent_control.evaluation.emit_control_events" ) as mock_emit , \
503- patch ("agent_control.evaluation.deliver_oss_events " ) as mock_deliver :
514+ patch ("agent_control.evaluation.enqueue_observability_events " ) as mock_enqueue :
504515 result = await evaluation .check_evaluation_with_local (
505516 client = client ,
506517 agent_name = "agent-000000000001" ,
@@ -512,7 +523,7 @@ async def test_merged_event_sink_emits_reconstructed_local_and_server_events_onc
512523 event_agent_name = "test-agent" ,
513524 )
514525
515- mock_deliver .assert_not_called ()
526+ mock_enqueue .assert_not_called ()
516527 mock_emit .assert_called_once ()
517528 merged_events = mock_emit .call_args .args [0 ]
518529 assert len (merged_events ) == 2
0 commit comments