Add checks when async functions are not properly awaited - #850
Merged
Conversation
fzyzcjy
requested review from
guapisolo,
maocheng23 and
yueming-yuan
as code owners
April 1, 2026 01:15
Contributor
There was a problem hiding this comment.
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.
…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
Revert the test extras approach — add pytest-asyncio directly to requirements.txt so it is installed by default with pip install -e .
Shi-Dong
pushed a commit
that referenced
this pull request
Apr 5, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.