feat(serial): ReaderControl restores ClearBuffer + GetInWaiting (closes #756)#761
Conversation
#756) PR #750 split `handle_serial_ws` into reader / writer / inbound tasks for throughput. As a side effect the `ClearBuffer` and `GetInWaiting` RPCs became logged no-ops -- both reach into the broadcast receiver `rx`, which is now owned exclusively by the reader task. Inbound couldn't touch it. This commit restores both via a new internal control channel: ```rust enum ReaderControl { Drain { reply: oneshot::Sender<usize> }, GetDepth { reply: oneshot::Sender<usize> }, } ``` Wiring: - Unbounded mpsc `(control_tx, control_rx)` created alongside the existing out-mpsc. - Reader's `tokio::select!` adds a branch on `control_rx.recv()`. `biased;` keeps broadcast forwarding the priority so a burst of inbound control requests cannot starve forwarding. - Inbound's `ClearBuffer` handler sends `Drain` over the control channel and awaits the oneshot reply with the drop count. - Inbound's `GetInWaiting` handler sends `GetDepth`, awaits the oneshot reply, and ships the `InWaiting { count }` response through the writer mpsc (preserves the writer-is-sole-WS-sink invariant from #750). Race safety: if the reader has exited between send and recv (session teardown race), the oneshot resolves with `Err` and the inbound handler logs debug / falls back to `count=0` rather than crashing. No API change visible to clients -- the SerialClientMessage protocol is unchanged, only the internals. Build: `soldr cargo build -p fbuild-daemon` clean. Refs #755 (meta). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 50 minutes and 40 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
Closes #756. Sub-PR of meta #755.
Summary
PR #750 split
handle_serial_wsinto reader / writer / inbound tasks for throughput, but the split moved the broadcast receiverrxexclusively into the reader task. As a side effect,ClearBufferandGetInWaiting(both of which reach intorx) became logged no-ops in the inbound task.This PR restores both via an internal cross-task control channel.
Design
(control_tx, control_rx)created alongside the existing out-mpsc inhandle_serial_ws.tokio::select!adds a branch oncontrol_rx.recv().biased;keeps broadcast forwarding the priority so a burst of inbound control requests cannot starve forwarding.ClearBufferhandler sendsDrain, awaits the oneshot reply with the drop count, logs.GetInWaitinghandler sendsGetDepth, awaits the oneshot reply, shipsInWaiting { count }through the writer-mpsc (preserves the writer-is-sole-WS-sink invariant from perf(serial): split daemon WS handler into reader/writer/inbound (closes #749) #750).Race safety: if reader exits between send and recv (session teardown), the oneshot resolves with
Errand inbound logs debug / falls back tocount=0.Protocol impact
None.
SerialClientMessage::ClearBufferandSerialClientMessage::GetInWaitingare unchanged on the wire. Only the internal handler implementation moved.Test plan
soldr cargo build -p fbuild-daemon— clean🤖 Generated with Claude Code