TextBatchAggregator for rapid-fire text events #631

Closed
opened 2026-10-27 13:37:06 +00:00 by sam · 0 comments
Owner

Batch rapid-fire inbound text events from the same sender/channel into a single dispatch instead of invoking the agent loop once per fragment. Chat clients (Telegram in particular) often split a user's thought across several quick messages; dispatching each separately wastes a full agent turn per fragment and can interleave responses oddly.

Context for implementers

No aggregator exists yet in internal/gateway. This sits upstream of the agent-loop dispatch, after platform adapters normalize events into MessageEvent (internal/gateway/messageevent.go) but before a turn is started (see internal/gateway/turn.go, turns.go).

Acceptance Criteria

Text events from the same channel arriving within a short configurable window are coalesced into one aggregated event before dispatch. A single non-batched message is not delayed by more than the window. Aggregation window is configurable, not hardcoded. Covered by a test using an injected clock.

Close reason

Closed


Imported from beads archie-core-1786637492528-105-c2b3caab · GitHub #126 · type task · priority P2 · created 2026-08-08 · closed 2026-10-01

Batch rapid-fire inbound text events from the same sender/channel into a single dispatch instead of invoking the agent loop once per fragment. Chat clients (Telegram in particular) often split a user's thought across several quick messages; dispatching each separately wastes a full agent turn per fragment and can interleave responses oddly. ### Context for implementers No aggregator exists yet in `internal/gateway`. This sits upstream of the agent-loop dispatch, after platform adapters normalize events into `MessageEvent` (`internal/gateway/messageevent.go`) but before a turn is started (see `internal/gateway/turn.go`, `turns.go`). ### Acceptance Criteria Text events from the same channel arriving within a short configurable window are coalesced into one aggregated event before dispatch. A single non-batched message is not delayed by more than the window. Aggregation window is configurable, not hardcoded. Covered by a test using an injected clock. ### Close reason Closed --- _Imported from beads `archie-core-1786637492528-105-c2b3caab` · GitHub #126 · type task · priority P2 · created 2026-08-08 · closed 2026-10-01_
sam added the mediumtask labels 2026-10-27 13:37:06 +00:00
sam self-assigned this 2026-10-27 13:37:06 +00:00
sam closed this issue 2026-10-27 13:37:06 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#631