From b2aef35a4270acd56f90d142a519503855c66900 Mon Sep 17 00:00:00 2001 From: Tee8z Date: Wed, 21 Oct 2026 08:00:13 -0400 Subject: [PATCH] test(agent): wait for both responses in the steer run-id mismatch test steer_rejected_on_run_id_mismatch stopped reading when the prompt turn finished. The fake LLM can finish the turn before the agent handles the steer, so the rejected steer's response can arrive after the turn's response. The test then reported "run-id mismatch was not rejected" even though the agent rejected it. The test now reads until it has both responses, and it still requires the steer to fail with invalid_params. On a saturated 16-core host the unchanged test failed 15 of 400 runs; with this change it failed 0 of 400. Signed-off-by: Tee8z --- crates/buzz-agent/tests/fake_llm.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/buzz-agent/tests/fake_llm.rs b/crates/buzz-agent/tests/fake_llm.rs index 2451deae088..cc6ad9d1b2b 100644 --- a/crates/buzz-agent/tests/fake_llm.rs +++ b/crates/buzz-agent/tests/fake_llm.rs @@ -983,7 +983,10 @@ async fn steer_rejected_on_run_id_mismatch() { ) .await; + // The fake turn can finish before the steer is handled, so the two + // responses arrive in either order; wait for both. let mut saw_reject = false; + let mut turn_done = false; for _ in 0..40 { let v = h.recv().await; if v["id"] == json!(s_id) { @@ -994,10 +997,15 @@ async fn steer_rejected_on_run_id_mismatch() { saw_reject = true; } else if v["id"] == json!(p_id) { // Turn finishes normally regardless of the rejected steer. + assert_eq!(v["result"]["stopReason"], "end_turn"); + turn_done = true; + } + if saw_reject && turn_done { break; } } assert!(saw_reject, "run-id mismatch was not rejected"); + assert!(turn_done, "turn did not finish after the rejected steer"); h.shutdown().await; }