test(cron): deterministically wait for ticker, fix wall-clock flake - #54010
Merged
Conversation
tests/cron/test_scheduler_provider.py spawned a background ticker thread, slept a fixed 0.2s, then asserted the loop had called tick()/heartbeat() at least N times. Under loaded CI the worker thread isn't always scheduled within that window, so the loop hadn't ticked yet — flaking with 'provider never called tick()' (assert 0 >= 1). Add a _wait_until(predicate, timeout) helper and replace all five fixed time.sleep(0.2) sites with a poll on the actual predicate (calls/beats count reached). Same contract assertions, no wall-clock dependence.
Contributor
🔎 Lint report:
|
pai-scaffolde
pushed a commit
to pai-scaffolde/hermes-agent
that referenced
this pull request
Jun 28, 2026
…ousResearch#54010) tests/cron/test_scheduler_provider.py spawned a background ticker thread, slept a fixed 0.2s, then asserted the loop had called tick()/heartbeat() at least N times. Under loaded CI the worker thread isn't always scheduled within that window, so the loop hadn't ticked yet — flaking with 'provider never called tick()' (assert 0 >= 1). Add a _wait_until(predicate, timeout) helper and replace all five fixed time.sleep(0.2) sites with a poll on the actual predicate (calls/beats count reached). Same contract assertions, no wall-clock dependence.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…ousResearch#54010) tests/cron/test_scheduler_provider.py spawned a background ticker thread, slept a fixed 0.2s, then asserted the loop had called tick()/heartbeat() at least N times. Under loaded CI the worker thread isn't always scheduled within that window, so the loop hadn't ticked yet — flaking with 'provider never called tick()' (assert 0 >= 1). Add a _wait_until(predicate, timeout) helper and replace all five fixed time.sleep(0.2) sites with a poll on the actual predicate (calls/beats count reached). Same contract assertions, no wall-clock dependence.
Jasper6439
pushed a commit
to Jasper6439/hermes-agent
that referenced
this pull request
Jul 5, 2026
…ousResearch#54010) tests/cron/test_scheduler_provider.py spawned a background ticker thread, slept a fixed 0.2s, then asserted the loop had called tick()/heartbeat() at least N times. Under loaded CI the worker thread isn't always scheduled within that window, so the loop hadn't ticked yet — flaking with 'provider never called tick()' (assert 0 >= 1). Add a _wait_until(predicate, timeout) helper and replace all five fixed time.sleep(0.2) sites with a poll on the actual predicate (calls/beats count reached). Same contract assertions, no wall-clock dependence.
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…ousResearch#54010) tests/cron/test_scheduler_provider.py spawned a background ticker thread, slept a fixed 0.2s, then asserted the loop had called tick()/heartbeat() at least N times. Under loaded CI the worker thread isn't always scheduled within that window, so the loop hadn't ticked yet — flaking with 'provider never called tick()' (assert 0 >= 1). Add a _wait_until(predicate, timeout) helper and replace all five fixed time.sleep(0.2) sites with a poll on the actual predicate (calls/beats count reached). Same contract assertions, no wall-clock dependence.
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…ousResearch#54010) tests/cron/test_scheduler_provider.py spawned a background ticker thread, slept a fixed 0.2s, then asserted the loop had called tick()/heartbeat() at least N times. Under loaded CI the worker thread isn't always scheduled within that window, so the loop hadn't ticked yet — flaking with 'provider never called tick()' (assert 0 >= 1). Add a _wait_until(predicate, timeout) helper and replace all five fixed time.sleep(0.2) sites with a poll on the actual predicate (calls/beats count reached). Same contract assertions, no wall-clock dependence.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…ousResearch#54010) tests/cron/test_scheduler_provider.py spawned a background ticker thread, slept a fixed 0.2s, then asserted the loop had called tick()/heartbeat() at least N times. Under loaded CI the worker thread isn't always scheduled within that window, so the loop hadn't ticked yet — flaking with 'provider never called tick()' (assert 0 >= 1). Add a _wait_until(predicate, timeout) helper and replace all five fixed time.sleep(0.2) sites with a poll on the actual predicate (calls/beats count reached). Same contract assertions, no wall-clock dependence.
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…ousResearch#54010) tests/cron/test_scheduler_provider.py spawned a background ticker thread, slept a fixed 0.2s, then asserted the loop had called tick()/heartbeat() at least N times. Under loaded CI the worker thread isn't always scheduled within that window, so the loop hadn't ticked yet — flaking with 'provider never called tick()' (assert 0 >= 1). Add a _wait_until(predicate, timeout) helper and replace all five fixed time.sleep(0.2) sites with a poll on the actual predicate (calls/beats count reached). Same contract assertions, no wall-clock dependence.
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.
Summary
tests/cron/test_scheduler_provider.pyno longer flakes on loaded CI. Five tests that spawned a background ticker thread, slept a fixed0.2s, then asserted the loop had calledtick()/heartbeat()at least N times now wait on the actual predicate instead.Root cause: Under loaded CI the freshly-spawned worker thread isn't always scheduled within the 200ms window, so the loop hadn't ticked yet when the assertion ran —
assert 0 >= 1/ "provider never called tick()". The wall-clock sleep was the bug.Changes
tests/cron/test_scheduler_provider.py: add a_wait_until(predicate, timeout)helper and replace all five fixedtime.sleep(0.2)sites with a poll on the real condition (calls/beats count reached). Same contract assertions, no wall-clock dependence.Validation
time.sleep(0.2)assert 0 >= 1Observed failing on PR #54007's CI run (slice 3/8); unrelated to that PR's change — this fixes the test itself.
Infographic