Repository navigation
test: count event-loop turns in the OpenClaw stop test - #459
Merged
AnuradhaKaruppiah merged 1 commit intoOct 20, 2026
Merged
AnuradhaKaruppiah merged 1 commit into
AnuradhaKaruppiah merged 1 commit into
Conversation
The test gave stop() 0.2 s of wall-clock time to propagate its cancellation. After the cancellation, stop() awaits only mocks and in-process tasks and finishes in 1 to 7 event-loop turns, so only a process pause could fail it: a pause of more than 0.2 s while the test waited could raise TimeoutError. A full garbage collection at this test takes 161 to 219 ms on an M-series Mac with Python 3.14 when tests/adapters/ runs, and the Python 3.14 jobs on Windows and linux-arm64 have been failing this test on pull requests that do not change stop() or this test. Wait for each step by counting event-loop turns (at most 100) instead of seconds. The test still fails when stop() keeps waiting on the blocked cleanup step after the cancellation, never reaches it, or returns without re-raising the cancellation. Signed-off-by: mnajafian-nv <mnajafian@nvidia.com>
AnuradhaKaruppiah
approved these changes
Oct 20, 2026
AnuradhaKaruppiah
temporarily deployed
to
fern
October 20, 2026 15:59 — with
GitHub Actions
Inactive
This branch was previously deployed
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.
Overview
The OpenClaw stop-cancellation test could fail with
TimeoutErrorwhen a process pause exhausted its 0.2 s cancellation deadline. This change replaces that deadline and the 1 s wait for cleanup to start with waits bounded by 100 event-loop turns.In this test, cleanup uses mocks and in-process tasks; progress does not require an external response or a timer to expire. The test still checks that
stop()reaches the blocked cleanup step, completes cleanup after cancellation, and propagatesCancelledErrorbefore the test releases that step. Productionstop()is unchanged.Details
stop()or this test: the[process]case on Windows in #452 and #443, and the[logs]case on linux-arm64 in #453.tests/adapters/on an M-series Mac with Python 3.14.7, explicitly triggered full garbage collections at this test took 160.7 to 219.1 ms, comparable to the old 0.2 s deadline.Validation
TimeoutErrorand 0 of 600 on 3.11. After it, 0 of 600 failed on both.stop()after the cancellation, Python 3.14: 600 of 600 failed before this change and 0 of 600 after it, and 0 of 600 after it with a second 250 ms stall before the blocked step.stop()continuing to wait on the blocked step after the cancellation, never reaching it, and swallowing the cancellation.tests/adapters/test_openclaw.py: 58 passed, 5 skipped.pre-commit run --files tests/adapters/test_openclaw.pypassed.Where should the reviewer start?
run_event_loop_untilintest_openclaw_stop_completes_cleanup_before_propagating_cancellationintests/adapters/test_openclaw.py.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Relates to: none
I confirm this contribution is my own work, or I have the right to submit it under this project's license.
I searched existing issues and open pull requests, and this does not duplicate existing work.
Summary by CodeRabbit