Skip to content

Fix nest_asyncio uvloop WebSocket import failure#1739

Open
ruizanthony wants to merge 1 commit into
agent0ai:mainfrom
ruizanthony:fix/uvloop-nest-asyncio-guard
Open

Fix nest_asyncio uvloop WebSocket import failure#1739
ruizanthony wants to merge 1 commit into
agent0ai:mainfrom
ruizanthony:fix/uvloop-nest-asyncio-guard

Conversation

@ruizanthony

Copy link
Copy Markdown

Summary

  • Avoid calling nest_asyncio.apply() on active uvloop event loops during WebUI imports.
  • Guard both helpers.task_scheduler and helpers.runtime so WebSocket connection setup does not fail with ValueError: Can't patch loop of type <class 'uvloop.Loop'>.
  • Add a regression test that imports helpers.task_scheduler inside a uvloop runner.

Verification

  • /a0/venv/bin/python3.12 -m pytest tests/test_task_scheduler_uvloop_import.py tests/test_task_scheduler_timezone.py -q5 passed
  • /a0/venv/bin/python3.12 -m py_compile helpers/task_scheduler.py helpers/runtime.py tests/test_task_scheduler_uvloop_import.py tests/test_task_scheduler_timezone.py
  • Live Agent Zero restart verified on local host: /api/health returned HTTP 200.
  • Post-restart logs showed accepted /socket.io WebSocket connections and no fresh WS on_connect error, Can't patch loop, uvloop.Loop, or traceback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant