fix(vegas): refresh scroll buffer on live score updates#299
fix(vegas): refresh scroll buffer on live score updates#299ChuckBuilds merged 2 commits intomainfrom
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 26 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdded throttled, periodic live-priority preemption checks into the display controller (using monotonic timing) to allow immediate mode switches from long-running display loops; expanded Vegas render recomposition triggers to consider pending updates for currently visible segments via new StreamManager query methods. Changes
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/display_controller.py (1)
82-82: Use one monotonic helper for this 30s live-priority gate.These two blocks are enforcing elapsed-time throttling, not wall-clock timestamps. On Raspberry Pi,
time.time()can step when the system clock syncs, which can delay or bunch the next probe; moving this behind one helper backed bytime.monotonic()keeps both loops consistent. If you make that switch, seed the loopstart_timefrom the same clock as well.Also applies to: 1794-1811, 1876-1890
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/display_controller.py` at line 82, Replace wall-clock time.time() uses for the 30s live-priority gate with a single monotonic clock: initialize self._next_live_priority_check using time.monotonic(), and change every comparison and seeding of start_time/start_time-like variables used by the live-priority gating logic to use time.monotonic() as well (or add a small helper monotonic_now() and call it everywhere). Update the code paths that set/compare self._next_live_priority_check and any start_time variables (the live-priority probe loops mentioned in the comment) so they are all based on the same monotonic clock to avoid clock-stepping issues on Raspberry Pi.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/vegas_mode/render_pipeline.py`:
- Around line 268-270: The current hot-swap check in render_pipeline (the call
to self.stream_manager.has_pending_updates()) triggers recomposition for any
queued plugin update; change this to only trigger when a pending update affects
visible segments by adding a StreamManager method like
has_pending_updates_for_visible_segments that checks whether any plugin_id in
self._pending_updates intersects the set of plugin_ids present in
self._active_buffer (only consider segments with images), and then replace the
render_pipeline call to has_pending_updates() with
has_pending_updates_for_visible_segments() so hot_swap_content() runs only for
updates that can change the current scroll.
---
Nitpick comments:
In `@src/display_controller.py`:
- Line 82: Replace wall-clock time.time() uses for the 30s live-priority gate
with a single monotonic clock: initialize self._next_live_priority_check using
time.monotonic(), and change every comparison and seeding of
start_time/start_time-like variables used by the live-priority gating logic to
use time.monotonic() as well (or add a small helper monotonic_now() and call it
everywhere). Update the code paths that set/compare
self._next_live_priority_check and any start_time variables (the live-priority
probe loops mentioned in the comment) so they are all based on the same
monotonic clock to avoid clock-stepping issues on Raspberry Pi.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 819c8ffd-56fd-459e-8a5e-1ceb91a35ebf
📒 Files selected for processing (3)
src/display_controller.pysrc/vegas_mode/render_pipeline.pysrc/vegas_mode/stream_manager.py
should_recompose() only checked for cycle completion or staging buffer content, but plugin updates go to _pending_updates — not the staging buffer. The scroll display kept showing the old pre-rendered image until the full cycle ended, even though fresh scores were already fetched and logged. Add has_pending_updates() check so hot_swap_content() triggers immediately when plugins have new data. Fixes #230 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. Replace has_pending_updates() with has_pending_updates_for_visible_segments() so hot_swap_content() only fires when a pending update affects a plugin that is actually in the active scroll buffer (with images). Avoids unnecessary recomposition when non-visible plugins report updates. 2. Switch all display-loop timing (start_time, elapsed, _next_live_priority_check) from time.time() to time.monotonic() to prevent clock-stepping issues from NTP adjustments on Raspberry Pi. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
738ba0a to
5cd9023
Compare
Summary
should_recompose()only checked for cycle completion or staging buffer content, but live plugin updates are queued in_pending_updates— not the staging bufferhas_pending_updates()toStreamManagerand wired it intoshould_recompose()sohot_swap_content()triggers immediately when plugins report new dataTest plan
Fixes #230
🤖 Generated with Claude Code
Summary by CodeRabbit
Improvements
Performance