mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
`stdio_turn.rs` drives the real binary against a real socket, but its fake provider only ever answers 200. buzz's deleted `llm.rs` tests covered the unhappy paths; nothing on this branch did. Five tests against a scriptable provider (429/401/500/truncated stream), driving the actual binary over stdio. The property under test is the one buzz owns and a user feels: a misbehaving provider ENDS THE TURN. Silence is the worst failure available to us — `buzz-acp` waits on that response, so a turn that never answers is an agent that has visibly stopped replying with nothing in the log to explain it. Each turn runs under a deadline so a hang fails as one test rather than stalling the suite. Deliberately not a port of the 149 `llm.rs` tests: nothing here asserts backoff timing, retry counts or `Retry-After` parsing. That is goose's logic to test, and re-asserting it would rebuild the duplication this PR deletes. What is asserted is observable behaviour through goose — including that 401 keeps its distinct `-32001` code, which `buzz-acp` routes on (`acp.rs:118`) to tell a credentials problem apart from a generic provider failure. Every test verified falsifiable by mutating the provider, not by inspection: making the 429 terminal, serving 401 as 500, letting the "persistent" 500 succeed, and keeping the second turn broken each fail the intended assertion with a clear message. That exercise also showed `BUZZ_AGENT_LLM_TIMEOUT_SECS` is load-bearing rather than test impatience: with the fake provider sleeping on a half-written stream the turn still ends, and with the timeout removed the prompt never answers at all. So the projection added in the previous commit is what rescues a provider that holds a socket open — noted at the line that depends on it. Co-authored-by: Michael Neale <michael.neale@gmail.com> Signed-off-by: Michael Neale <michael.neale@gmail.com>