Repository navigation
test flake: test_rate_limited_post_carries_retry_after gets 201 when the first POST takes 2s+ (pin the limiter clock) - #4020
Conversation
The test was flaky on loaded runners because the first POST could take 2s+,
allowing the token bucket to refill and the second POST to succeed (201)
instead of being rate limited (429).
Fix: patch tinyagentos.rate_limit.time.monotonic to a fixed value before
constructing the RateLimiter, and tighten the retry-after assertion to
exactly 2 seconds.
20-run tally:
2 1 passed, 7 deselected in 3.57s
1 1 passed, 7 deselected in 3.59s
1 1 passed, 7 deselected in 3.60s
1 1 passed, 7 deselected in 3.66s
1 1 passed, 7 deselected in 3.67s
1 1 passed, 7 deselected in 3.73s
1 1 passed, 7 deselected in 3.74s
1 1 passed, 7 deselected in 3.77s
1 1 passed, 7 deselected in 3.83s
1 1 passed, 7 deselected in 3.85s
2 1 passed, 7 deselected in 3.88s
1 1 passed, 7 deselected in 3.93s
1 1 passed, 7 deselected in 3.99s
1 1 passed, 7 deselected in 4.05s
1 1 passed, 7 deselected in 4.07s
1 1 passed, 7 deselected in 4.08s
1 1 passed, 7 deselected in 4.31s
1 1 passed, 7 deselected in 4.51s
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Freeze time and assert retry delay tests/test_routes_client_logs.py |
The test freezes time.monotonic at 1000.0 before sending two posts. It replaces the prior allowance of 1 or 2 seconds with an exact Retry-After assertion of 2 seconds. |
Priority:
Estimated code review effort: 1 (Trivial) | ~3 minutes
Change: Bug fix
Merge Risk: 
Minimal · up to 3c3bc
-
The change removes elapsed-time sensitivity from the rate-limit test and checks the expected two-second retry delay. No actionable merge-blocking issue was identified; merge after normal checks pass.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.
-
Finishing Touches: 💡 1
-
🛠️ Fix failing CI checks: 💡
-
- Commit to this branch
- Create a new PR
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Lead review (tsk-k4bvzj): PASS. The diff does exactly what the card asked: it freezes the limiter clock before the bucket is built and asserts retry-after == 2. 35/38 checks are green. The 3 that are not are all CodeRabbit, which is rate-limited on this head. Non-blocking note, carried to a follow-up: @coderabbitai review |
✅ Action performed
|
CARD TITLE (intent, not commit subject): test flake: test_rate_limited_post_carries_retry_after gets 201 when the first POST takes 2s+ (pin the limiter clock)
Autonomous build of board card tsk-k4bvzj.
test: freeze limiter clock in test_rate_limited_post_carries_retry_after
The test was flaky on loaded runners because the first POST could take 2s+,
allowing the token bucket to refill and the second POST to succeed (201)
instead of being rate limited (429).
Fix: patch tinyagentos.rate_limit.time.monotonic to a fixed value before
constructing the RateLimiter, and tighten the retry-after assertion to
exactly 2 seconds.
20-run tally:
2 1 passed, 7 deselected in 3.57s
1 1 passed, 7 deselected in 3.59s
1 1 passed, 7 deselected in 3.60s
1 1 passed, 7 deselected in 3.66s
1 1 passed, 7 deselected in 3.67s
1 1 passed, 7 deselected in 3.73s
1 1 passed, 7 deselected in 3.74s
1 1 passed, 7 deselected in 3.77s
1 1 passed, 7 deselected in 3.83s
1 1 passed, 7 deselected in 3.85s
2 1 passed, 7 deselected in 3.88s
1 1 passed, 7 deselected in 3.93s
1 1 passed, 7 deselected in 3.99s
1 1 passed, 7 deselected in 4.05s
1 1 passed, 7 deselected in 4.07s
1 1 passed, 7 deselected in 4.08s
1 1 passed, 7 deselected in 4.31s
1 1 passed, 7 deselected in 4.51s
Files:
tests/test_routes_client_logs.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
In-house review (pre-PR)
in-house-review: PASS (kilo/nvidia/nemotron-3-ultra-550b-a55b:free)
reviewer output
VERDICT: PASS
In-house-Review: PASS model=kilo/nvidia/nemotron-3-ultra-550b-a55b:free head=3c3bc228d needs-lead=0
Summary by CodeRabbit