Skip to content

Add checks when async functions are not properly awaited - #850

Merged
fzyzcjy merged 8 commits into
mainfrom
feat/async_check
Apr 3, 2026
Merged

Add checks when async functions are not properly awaited#850
fzyzcjy merged 8 commits into
mainfrom
feat/async_check

Conversation

@fzyzcjy

@fzyzcjy fzyzcjy commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to treat unawaited coroutines as fatal errors by overriding sys.unraisablehook and configuring RuntimeWarning filters to trigger a process exit. The changes include the configure_strict_async_warnings utility and a comprehensive test suite. The review feedback identifies a critical issue in the test suite where the _setup_warning_filter fixture modifies the global sys.unraisablehook without restoring it, which can lead to side effects and nested hooks across tests. A suggestion was provided to ensure the original hook is restored after each test to maintain isolation.

Comment thread tests/fast/utils/test_logging_utils.py
fzyzcjy added 2 commits April 1, 2026 09:37
…tion

Address Gemini review feedback on PR #850: the _setup_warning_filter
fixture was modifying sys.unraisablehook without restoring it, causing
nested hooks across tests.
- Add pytest-asyncio install to CI workflow (both j2 template and generated yml)
- Configure asyncio_mode = "auto" in pyproject.toml
- Register asyncio marker to avoid strict-markers warning
- Replace deprecated asyncio.get_event_loop() with asyncio.run()
- Restore sys.unraisablehook in test fixture for proper test isolation
@fzyzcjy
fzyzcjy requested a review from yushengsu-thu as a code owner April 1, 2026 01:42
@fzyzcjy
fzyzcjy merged commit 53c88d4 into main Apr 3, 2026
16 of 17 checks passed
@fzyzcjy
fzyzcjy deleted the feat/async_check branch April 3, 2026 03:16
fzyzcjy added a commit that referenced this pull request Apr 3, 2026
PR #850 added test_eager_create_task in test_logging_utils.py which
imports eager_create_task from miles.utils.async_utils, but the function
was only defined in the trainer_ft/dev branch (PR #823) and never merged
to main, breaking CI fast tests.

Cherry-pick the async_utils changes from PR #823.
Shi-Dong pushed a commit that referenced this pull request Apr 5, 2026
PR #850 added test_eager_create_task in test_logging_utils.py which
imports eager_create_task from miles.utils.async_utils, but the function
was only defined in the trainer_ft/dev branch (PR #823) and never merged
to main, breaking CI fast tests.

Cherry-pick the async_utils changes from PR #823.
GuanxingLu pushed a commit to GuanxingLu/miles that referenced this pull request Apr 21, 2026
GuanxingLu pushed a commit to GuanxingLu/miles that referenced this pull request Apr 21, 2026
PR radixark#850 added test_eager_create_task in test_logging_utils.py which
imports eager_create_task from miles.utils.async_utils, but the function
was only defined in the trainer_ft/dev branch (PR radixark#823) and never merged
to main, breaking CI fast tests.

Cherry-pick the async_utils changes from PR radixark#823.
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