@@ -2,13 +2,15 @@ package pubsub
8// bufferSize is the per-subscriber channel capacity for any broker
9// bufferSize is the per-subscriber channel capacity for any broker
9// created via NewBroker. Publish is non-blocking, so a full buffer
10// created via NewBroker. Publish is non-blocking, so a full buffer
10−// silently drops events; sized to cover a long streaming assistant
11+// drops events (with a warning log); sized to cover a long streaming
11−// turn (~one UpdatedEvent per token) even under TUI render stalls.
12+// assistant turn (~one UpdatedEvent per token) even under TUI render
12const bufferSize = 4096
14const bufferSize = 4096
14type Broker[T any] struct {
16type Broker[T any] struct {
@@ -108,8 +110,9 @@ func (b *Broker[T]) Publish(t EventType, payload T) {
109 case sub <- event:
111 case sub <- event:
111− // Channel is full, subscriber is slow - skip this event
113+ // Channel is full, subscriber is slow — skip this event.
112− // This prevents blocking the publisher
114+ // This prevents blocking the publisher.
115+ slog.Warn("Pubsub buffer full; dropping event", "type", t)