Rate-limited webhook deliveries reply with chat prose, or 202 a dropped event #1662

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

Found while closing archie-core-oyna (commit 1fe4691b); pre-existing, not introduced there.

internal/gateway/gateway.go's Router.Route returns rateLimitReply -- the chat-facing text "You're sending messages too quickly. Please wait a moment and try again." -- as the route reply when a message exceeds its inbound budget (internal/ratelimit), with a nil error.

internal/channels/webhook/webhook.go's handler then branches on route.DeliverTo: with "origin" it writes that prose as a 200 response to the external caller, and otherwise it writes 202 Accepted. So a source that has exceeded its per-route budget either gets chat prose in a success response, or a 202 for an event that was dropped before reaching the LLM -- indistinguishable from a delivered one, so the source will not retry and the event is lost.

The rate limit itself is correct and documented (config.RateLimitConfig keys webhooks per route path); this is only the rejection's delivery semantics at an HTTP edge, which wants a 429 so the caller can back off and retry, the way internal/webhookguard.RateLimiter's other callers do (docs/prds/webhook-intake-security.md point 3: a rejected request must be surfaced as an observable rejection, never silently dropped).

Evidence: internal/gateway/gateway.go (checkRateLimit/RateRoute reply), internal/channels/webhook/webhook.go (handleWebhook's DeliverTo branch), internal/webhookguard/ratelimit.go (the 429 precedent).

Close reason

Fixed: messaging.ChatReply gained RateLimited with Route as a thin wrapper over RouteResult (string, rateLimited, error), and the webhook handler checks the flag before DeliverTo and answers 429 (commit 04dfa29d, on current HEAD; verified in-tree this sweep: gateway.go RouteResult and internal/channels/webhook/webhook.go's RateLimited branch), matching the webhookguard rate limiter's precedent.


Imported from beads archie-core-xsdg · GitHub #1173 · type bug · priority P3 · created 2026-09-21 · closed 2026-09-29

Found while closing archie-core-oyna (commit 1fe4691b); pre-existing, not introduced there. internal/gateway/gateway.go's Router.Route returns rateLimitReply -- the chat-facing text "You're sending messages too quickly. Please wait a moment and try again." -- as the route reply when a message exceeds its inbound budget (internal/ratelimit), with a nil error. internal/channels/webhook/webhook.go's handler then branches on route.DeliverTo: with "origin" it writes that prose as a 200 response to the external caller, and otherwise it writes 202 Accepted. So a source that has exceeded its per-route budget either gets chat prose in a success response, or a 202 for an event that was dropped before reaching the LLM -- indistinguishable from a delivered one, so the source will not retry and the event is lost. The rate limit itself is correct and documented (config.RateLimitConfig keys webhooks per route path); this is only the rejection's delivery semantics at an HTTP edge, which wants a 429 so the caller can back off and retry, the way internal/webhookguard.RateLimiter's other callers do (docs/prds/webhook-intake-security.md point 3: a rejected request must be surfaced as an observable rejection, never silently dropped). Evidence: internal/gateway/gateway.go (checkRateLimit/RateRoute reply), internal/channels/webhook/webhook.go (handleWebhook's DeliverTo branch), internal/webhookguard/ratelimit.go (the 429 precedent). ### Close reason Fixed: messaging.ChatReply gained RateLimited with Route as a thin wrapper over RouteResult (string, rateLimited, error), and the webhook handler checks the flag before DeliverTo and answers 429 (commit 04dfa29d, on current HEAD; verified in-tree this sweep: gateway.go RouteResult and internal/channels/webhook/webhook.go's RateLimited branch), matching the webhookguard rate limiter's precedent. --- _Imported from beads `archie-core-xsdg` · GitHub #1173 · type bug · priority P3 · created 2026-09-21 · closed 2026-09-29_
sam added the lowbug labels 2026-10-27 13:41:17 +00:00
sam self-assigned this 2026-10-27 13:41:17 +00:00
sam closed this issue 2026-10-27 13:41:17 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1662