Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environments/agent_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def _tc_to_dict(tc):
# Run tool calls in a thread pool so backends that
# use asyncio.run() internally (modal, docker, daytona) get
# a clean event loop instead of deadlocking.
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
# Capture current tool_name/args for the lambda
_tn, _ta, _tid = tool_name, args, self.task_id
tool_result = await loop.run_in_executor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ async def rollout_and_score_eval(self, eval_item: Dict[str, Any]) -> Dict:
# other tasks, tqdm updates, and timeout timers).
ctx = ToolContext(task_id)
try:
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
reward = await loop.run_in_executor(
None, # default thread pool
self._run_tests, eval_item, ctx, task_name,
Expand Down
6 changes: 3 additions & 3 deletions hermes_cli/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ async def get_status():
remote_health_body: dict | None = None

if not gateway_running and _GATEWAY_HEALTH_URL:
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
alive, remote_health_body = await loop.run_in_executor(
None, _probe_gateway_health
)
Expand Down Expand Up @@ -1845,7 +1845,7 @@ def _do_nous_device_request():
client_id=client_id,
scope=scope,
)
device_data = await asyncio.get_event_loop().run_in_executor(None, _do_nous_device_request)
device_data = await asyncio.get_running_loop().run_in_executor(None, _do_nous_device_request)
sid, sess = _new_oauth_session("nous", "device_code")
sess["device_code"] = str(device_data["device_code"])
sess["interval"] = int(device_data["interval"])
Expand Down Expand Up @@ -2134,7 +2134,7 @@ async def submit_oauth_code(provider_id: str, body: OAuthSubmitBody, request: Re
"""Submit the auth code for PKCE flows. Token-protected."""
_require_token(request)
if provider_id == "anthropic":
return await asyncio.get_event_loop().run_in_executor(
return await asyncio.get_running_loop().run_in_executor(
None, _submit_anthropic_pkce, body.session_id, body.code,
)
raise HTTPException(status_code=400, detail=f"submit not supported for {provider_id}")
Expand Down
8 changes: 4 additions & 4 deletions tools/browser_cdp_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ async def _cdp_call(
}
)
)
deadline = asyncio.get_event_loop().time() + timeout
deadline = asyncio.get_running_loop().time() + timeout
while True:
remaining = deadline - asyncio.get_event_loop().time()
remaining = deadline - asyncio.get_running_loop().time()
if remaining <= 0:
raise TimeoutError(
f"Timed out attaching to target {target_id}"
Expand Down Expand Up @@ -166,9 +166,9 @@ async def _cdp_call(
req["sessionId"] = session_id
await ws.send(json.dumps(req))

deadline = asyncio.get_event_loop().time() + timeout
deadline = asyncio.get_running_loop().time() + timeout
while True:
remaining = deadline - asyncio.get_event_loop().time()
remaining = deadline - asyncio.get_running_loop().time()
if remaining <= 0:
raise TimeoutError(
f"Timed out waiting for response to {method}"
Expand Down