mirror of
https://github.com/block/buzz.git
synced 2026-10-28 21:11:48 +00:00
Addresses salman1993's review at d2cc2e177 (two P1s) and the follow-up
environment-variable round:
- Cancellable stream construction (P1). goose's Provider::stream() awaits
the HTTP POST — headers included — before returning, so a queued/wedged
gateway stalled the turn outside the cancellation select and keepalive
ticker. The construction future is now covered by the same select as
chunk consumption. Regression test parks the completion socket
pre-headers and asserts session/cancel returns `cancelled` promptly.
- Proactive compaction budget (P1). A user prompt that alone exceeds the
byte-estimated threshold re-tripped the gate after every successful
summary (8 summary requests, zero inference). Budget is now one
proactive compaction per inference; forced (reactive) compaction also
consumes it, and a successful inference re-arms it. Genuine overflow
still takes the bounded reactive path (3 per turn). Regression test
reproduces the oversized-prompt spin.
- BUZZ_AGENT_MAX_TOKEN_RECOVERIES restored (default 3). goose marks
output-token-truncated responses but leaves policy to the embedder.
Truncated tool calls are discarded (never executed), surviving text is
preserved, and a continue nudge is injected within the bounded budget;
exhaustion surfaces as `max_tokens`. The truncation flag is also
propagated through chunk accumulation so the marker message's metadata
is not lost.
- BUZZ_AGENT_MAX_HISTORY_BYTES restored (default 16 MiB, 1 MiB floor).
Compaction hides messages from the model rather than deleting them, so
carried-forward session history grew without bound. The oldest
agent-invisible messages are now evicted once the stored history
exceeds the budget; model-visible messages are never evicted.
- BUZZ_AGENT_MAX_HANDOFFS stays removed: the compaction it bounded is now
bounded structurally (one proactive per inference + 3 reactive per
turn); the README row documents the replacement.
Co-authored-by: Galadriel <galadriel@buzz.agents>
Signed-off-by: Michael Neale <michael.neale@gmail.com>