block / block/buzz

steer_rejected_on_empty_prompt is flaky due to response-order race

Open
#4,939 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
32.7k
Forks
4.3k
Avg merge
1d 13h
Merged PRs (30d)
253

Description

**Describe the bug**
In desktop-v0.5.5, buzz-agent tests can intermittently fail with:

empty steer prompt was not rejected

The implementation in crates/buzz-agent/src/lib.rs::steer_session correctly rejects an empty prompt with INVALID_PARAMS.

The race is in `crates/buzz-agent/tests/fake_llm.rs::steer_rejected_on_empty_prompt`. Its receive loop stops when the concurrent session/prompt response arrives, even if the steer rejection response has not yet been read:

```
} else if v["id"] == json!(p_id) {
break;
}
```

Suggested change: wait specifically for the steer response, as other tests do:

```
let v = h.recv_until(|v| v["id"] == json!(s_id)).await;
assert_eq!(v["error"]["code"], -32602);
```

This tests the intended behavior without depending on response ordering between the prompt and steer requests.

**Expected behavior**

It's a race condition, so it fails intermittently (3/10 times with `--release -p fake_llm`).
Expect tests to pass 100% of attempts.

**Version and platform**
0.5.5 on x86_64-linux

**Additional info**

I tried running the specific failing test
```
for i in {1..10}; do
cargo test --release -p buzz-agent --test fake_llm steer_rejected_on_empty_prompt -- --exact || break
done
```
and it passed 10/10 times. so the. race condition depends on other parallel factors.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.