Repository navigation
test(agents): rate-limit sleep test counts only the agent's own sleeps - #5355
Merged
Merged
Conversation
own_sleeps patched time.sleep for every module, so when logging on the test thread waited on the log-rotation file lock (a 5 ms retry), that sleep landed in the list and test_rate_limit_wait_is_capped failed at random, most often on macOS CI. It now records only sleeps called from gaia.agents.base.agent.
Contributor
|
Verdict: Approve This should fix the flaky rate-limit test. The test's sleep recorder used to catch every pause on the test's thread, including the short retry the log-file lock makes while the agent logs "waiting…". It now counts only pauses made by the agent code under test. The new self-check fails with the old recorder and passes with this one, so the cause is pinned down, not just made less likely. No blocking issues. Real-world evidenceN/A: this PR only changes tests, and no user-facing surface is affected. The verdict rests on static review. I could not run the suite here because pytest isn't installed on this runner. The author reports 42 passing. 🔍 Technical detailsIssues found: none blocking.
Strengths
|
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.
test_rate_limit_wait_is_cappedfailed at random, most often on macOS CI (e.g. on #5337). Theown_sleepsfixture patchedtime.sleepfor every module. When logging on the test's thread waited on the log-rotation file lock, that lock's 5 ms retry landed in the list. The fixture now records only sleeps called fromgaia.agents.base.agent, the code under test.Reproduced by the new
test_own_sleeps_ignores_sleeps_from_other_code_on_this_thread: it fails with the old fixture and passes here.Test plan
pytest tests/unit/agents/test_loop_guard_correction.py: 42 passedpython util/lint.py --black --isort --pylint --flake8