Skip to content

fix(gpu-arbiter): clamp drain_tick_seconds floor + remove double _signal_capacity wake#1987

Open
hognek wants to merge 2 commits into
jaylfc:devfrom
hognek:fix/kilo-gpu-arbiter-1986
Open

fix(gpu-arbiter): clamp drain_tick_seconds floor + remove double _signal_capacity wake#1987
hognek wants to merge 2 commits into
jaylfc:devfrom
hognek:fix/kilo-gpu-arbiter-1986

Conversation

@hognek

@hognek hognek commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Task: t_eb4779c9

Addresses Kilo review findings on #1986:

1. Clamp drain_tick_seconds to >= 0.01 (line 137)

asyncio.wait_for(self._wake.wait(), timeout=0) raises ValueError and
crashes the _process_queue drain loop on startup when
drain_tick_seconds is zero or negative. Now clamped with
max(drain_tick_seconds, 0.01) in __init__.

2. Remove redundant _signal_capacity() call (line 448)

_run_gpu_task's finally called _signal_capacity() at line 448, but
_release_reservation (called immediately above at line 444) already fires
_signal_capacity() at line 250. Double-wake on every task completion.
While Event.set() is idempotent, the duplicate was redundant — removed.

Tests

32/32 GPU arbiter tests pass (test_gpu_arbiter_894.py, test_gpu_arbiter_toctou.py,
test_gpu_arbiter_wakeup.py, test_gpu_queue_flag.py).

hognek added 2 commits July 18, 2026 12:22
…ck (jaylfc#1864 A3)

Replace the hardcoded asyncio.sleep(2) in _process_queue with an
asyncio.Event-based wake path.  The drain loop now blocks on
asyncio.wait_for(self._wake.wait(), timeout=drain_tick_seconds) so a
reservation release or task completion immediately wakes the drain
loop.  The 2 s constant becomes the configurable fallback timeout
(drain_tick_seconds, default 2.0).

- __init__: new drain_tick_seconds param, self._wake Event
- _signal_capacity(): new method — calls self._wake.set()
- _process_queue: event-driven wait + clear, fallback timeout
- _release_reservation: calls _signal_capacity on actual release
- _run_gpu_task finally: calls _signal_capacity on completion
- tests/test_gpu_arbiter_wakeup.py: 2 new tests
  * test_release_triggers_immediate_drain (60 s tick, < 0.5 s admit)
  * test_poll_tick_still_drains_without_signal (0.1 s tick)
…nal_capacity wake

Kilo review on jaylfc#1986:
1. Clamp drain_tick_seconds to >= 0.01 in __init__ to prevent
   asyncio.wait_for(timeout=0) ValueError crash in _process_queue.
2. Remove redundant _signal_capacity() in _run_gpu_task finally —
   _release_reservation already calls it at line 250, making the
   line-448 call a double-wake on every task completion.

32/32 GPU arbiter tests pass.
@hognek
hognek marked this pull request as ready for review July 18, 2026 10:39
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@hognek, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b41e2c0e-0f58-4eed-8cc3-f2f5e6e91c0f

📥 Commits

Reviewing files that changed from the base of the PR and between 0e6e6fa and 6971b36.

📒 Files selected for processing (2)
  • tests/test_gpu_arbiter_wakeup.py
  • tinyagentos/scheduler/gpu_arbiter.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@kilo-code-bot

kilo-code-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • tinyagentos/scheduler/gpu_arbiter.py - 0 issues
  • tests/test_gpu_arbiter_wakeup.py - 0 issues

Reviewed by hy3:free · Input: 37.6K · Output: 1.2K · Cached: 106.9K

@gitar-bot

gitar-bot Bot commented Jul 18, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant