The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: exercise approval rendering through initialized turn runners
Teknium76efc227017e
diff --git a/tests/gateway/test_approval_prompt_redaction.py b/tests/gateway/test_approval_prompt_redaction.pyindex 592a71dcbf4..af952bd0279 100644--- a/tests/gateway/test_approval_prompt_redaction.py+++ b/tests/gateway/test_approval_prompt_redaction.py@@ -112,9 +112,38 @@ class TestApprovalCommandWiring:)def test_chat_platform_path_redacts_before_send(self):- import gateway.run_turn_runner as run-- self._assert_redacts_then_uses(run, "_approval_notify_sync", "send_exec_approval")+ import asyncio+ from types import SimpleNamespace+ from gateway.run_turn_runner import TurnRunner++ async def exercise():+ for card_success in (True, False):+ sent = []++ class Adapter:+ def pause_typing_for_chat(self, chat_id):+ pass++ async def send_exec_approval(self, **kwargs):+ sent.append(kwargs['command'])+ return SimpleNamespace(success=card_success, error=None)++ async def send(self, chat_id, text, **kwargs):+ sent.append(text)+ return SimpleNamespace(success=True)++ ctx = SimpleNamespace(_status_adapter=Adapter(), _status_chat_id='fixture',+ _status_thread_metadata=None, session_key='redaction-fixture',+ _loop_for_step=asyncio.get_running_loop(), stream_consumer_holder=[None])+ turn = TurnRunner(SimpleNamespace(), ctx)+ raw = 'curl -H "Authorization: token ' + _FAKE_GHP + '" https://example.test'+ approval = {'command': raw, 'description': 'fixture'}+ await asyncio.to_thread(turn._approval_notify_sync, approval)+ assert len(sent) == (1 if card_success else 2)+ assert all(_FAKE_GHP not in text and 'curl' in text for text in sent)+ assert approval['command'] == raw++ asyncio.run(exercise())def test_sse_api_path_redacts_before_enqueue(self):from gateway.platforms import api_server_runsdiff --git a/tests/gateway/test_decline_fallback_suppression.py b/tests/gateway/test_decline_fallback_suppression.pyindex 7e38ed6308a..df619859dc7 100644--- a/tests/gateway/test_decline_fallback_suppression.py+++ b/tests/gateway/test_decline_fallback_suppression.py@@ -55,7 +55,6 @@ def _runner(adapter: _Adapter):"""A TurnRunner driven through its real _approval_notify_sync."""from gateway.run_turn_runner import TurnRunner- runner = object.__new__(TurnRunner)ctx = SimpleNamespace(_status_adapter=adapter,_status_chat_id="C1",@@ -64,7 +63,7 @@ def _runner(adapter: _Adapter):session_key="sk1",source=SimpleNamespace(chat_id="C1", platform="discord", session_key="sk1"),)- runner._ctx = ctx+ runner = TurnRunner(SimpleNamespace(), ctx)class _Fut:def __init__(self, result): self._r = result