CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
fix(hitl): use get_running_loop + tighten resume-slot-keep test assertion
xf gonge772e6e2a117
diff --git a/cubepi/hitl/channel.py b/cubepi/hitl/channel.pyindex 9d24731..b96c326 100644--- a/cubepi/hitl/channel.py+++ b/cubepi/hitl/channel.py@@ -138,7 +138,7 @@ class _BaseChannel:timeout_seconds=effective_timeout,)self._pending = req- self._future = asyncio.get_event_loop().create_future()+ self._future = asyncio.get_running_loop().create_future()exc_caught: BaseException | None = Nonesignal_task: asyncio.Future[Any] | None = Nonediff --git a/tests/hitl/test_in_memory_channel.py b/tests/hitl/test_in_memory_channel.pyindex 70d41b7..3a515b5 100644--- a/tests/hitl/test_in_memory_channel.py+++ b/tests/hitl/test_in_memory_channel.py@@ -215,6 +215,7 @@ async def test_attach_resume_answer_qid_mismatch_keeps_slot():for a different question and should NOT be popped)."""ch = InMemoryChannel()ch.attach_resume_answer("tc-OLD", True)+ assert ch._resume_slot == ("tc-OLD", True) # baselineasync def host():while ch.pending is None:@@ -226,3 +227,6 @@ async def test_attach_resume_answer_qid_mismatch_keeps_slot():asyncio.create_task(host())ans = await ch.approve(tool_name="bash", tool_call_id="tc-NEW", args={})assert ans.decision == "deny"+ # Slot for the OLD qid is still pre-loaded (the implementation should+ # NOT pop it just because a different qid came through).+ assert ch._resume_slot == ("tc-OLD", True)