Skip to content

Commit 10aaa72

Browse files
wpfleger96npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7
andauthored
fix(buzz-acp): clear steer_rx on all run_prompt_task exit paths (#1391)
Signed-off-by: Will Pfleger <[email protected]> Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
1 parent 0827171 commit 10aaa72

2 files changed

Lines changed: 273 additions & 88 deletions

File tree

‎crates/buzz-acp/src/acp.rs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,25 @@ impl AcpClient {
522522
self.steer_rx = Some(rx);
523523
}
524524

525+
/// Clear any installed steer receiver without consuming it.
526+
///
527+
/// Called by `send_prompt_result` on every exit path of `run_prompt_task`
528+
/// so that `install_steer_rx`'s `is_none()` invariant holds for the next
529+
/// dispatch even when the turn ended before the read loop ran `take()`.
530+
/// Idempotent — safe to call when `steer_rx` is already `None`.
531+
pub fn clear_steer_rx(&mut self) {
532+
self.steer_rx = None;
533+
}
534+
535+
/// Returns `true` if no steer receiver is currently installed.
536+
///
537+
/// Test-only: used by `pool` tests to assert the post-return invariant
538+
/// without exposing the private field directly.
539+
#[cfg(test)]
540+
pub fn steer_rx_is_none(&self) -> bool {
541+
self.steer_rx.is_none()
542+
}
543+
525544
/// Cancel a turn cleanly, handling any pending permission request first.
526545
///
527546
/// Steps:

0 commit comments

Comments
 (0)