steer_rejected_on_empty_prompt is flaky due to response-order race

Open Beginner friendly
#4,939 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
90/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
testing

Research direction

Start in crates/buzz-agent/tests/fake_llm.rs at steer_rejected_on_empty_prompt and compare its receive loop with the other response-specific tests. Run the exact cargo test command from the issue, repeating it as needed. Done means the test waits for the steer response and consistently verifies the -32602 error without depending on response order.

Written by the indexing model from the issue text.

Description

bug

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.

Dominant language
Rust
Stars
33.7k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
239

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from block/buzz

All issues in block/buzz

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.