You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a6ccf6a
Browse filesBrowse the repository at this point in the historyBrowse files
docs(line): document inbound durability, retry policy, and dead-letter recovery (#115702)
* docs(line): document inbound durability, retry policy, and dead-letter recovery
* docs(line): clarify non-retryable failures skip retries at any attempt
* docs(line): note the durable-acceptance marker and polish the durability section
* docs(line): correct dead-owner claim recovery timing
* docs(line): make dead-letter recovery reason-specific
* docs(line): bound lane independence by concurrency and cite LINE redelivery
The per-conversation ordering bullet claimed a retrying event never delays
other chats. Lanes are independent, but the drain stops claiming once eight
deliveries are active, so a ninth lane waits for a slot. State the cap as the
bound on cross-chat progress.
The webhook redelivery paragraph asserted the LINE Console prerequisite with
no source. Link the Messaging API documentation, name the second condition
(no 2xx from the bot server), and record that LINE does not guarantee
redelivery, does not disclose retry count or interval, and may resend out of
order or more than once.
* docs(line): describe the stall watchdog as retrying, not dead-lettering
* docs(line): scope the stall watchdog to the pre-adoption window
* docs(line): qualify duplicate suppression by the record cap, not only the TTL
* docs(line): account for deferred ingress heartbeats
* docs(line): fix handler-timeout grammar
* docs(line): match admission-owned retention semantics
* docs(line): correct webhook verification method
---------
Co-authored-by: Patrick Erichsen <[email protected]>
The Gateway answers LINE's webhook verification (GET). For signed inbound events
46
-
(POST), it writes each event to the durable ingress queue before returning `200`;
47
-
agent processing continues asynchronously. Failed delivery is retried from the
48
-
queue, including after a Gateway restart, and poison events become failed queue
49
-
records after bounded retries. If durable persistence fails, the request returns
45
+
The Gateway answers LINE's signed webhook verification request: a `POST` with an
46
+
empty `events` list. For signed inbound events, it writes each event to the durable
47
+
ingress queue before returning `200`; agent processing continues asynchronously.
48
+
Failed delivery is retried from the queue, including after a Gateway restart, and
49
+
poison events become failed queue records after bounded retries. If durable
50
+
persistence fails, the request returns
50
51
`500` instead of acknowledging an event that could be lost.
51
52
Delivery is at least once across the queue-to-agent boundary: a Gateway shutdown or
52
53
crash during an active delivery can replay the turn. Message events deduplicate by
@@ -61,6 +62,77 @@ Security notes:
61
62
- LINE signature verification is body-dependent (HMAC over the raw body), so OpenClaw applies a strict pre-auth body limit (64 KB) and read timeout before verification.
62
63
- OpenClaw processes webhook events from the verified raw request bytes. Upstream middleware-transformed `req.body` values are ignored for signature-integrity safety.
63
64
65
+
## Inbound durability
66
+
67
+
The [Setup](#setup) webhook contract acknowledges an event only after it is durably
68
+
queued. The durable `200` carries `x-openclaw-delivery-accepted: durable`; signed
69
+
verification pings (empty event lists) and error responses omit the marker, so
70
+
reverse proxies can require it to distinguish durable acceptance from a generic
71
+
`200`. From there, delivery runs through the core channel-ingress drain with
72
+
LINE-specific settings:
73
+
74
+
-**Per-conversation ordering.** Events are serialized by source lane —
75
+
`group:<groupId>`, `room:<roomId>`, or `user:<userId>`; events without a
76
+
conversation source use their own event-scoped lane. Within a lane, events
77
+
dispatch in received order, so a retrying event delays later events in the same
78
+
chat. One chat's backlog never blocks another chat's lane, but all lanes share
79
+
a cap of 8 concurrent deliveries: other chats progress independently while a
80
+
slot is free, and a 9th lane waits for one to open.
81
+
-**Retries.** A failed delivery retries with exponential backoff starting at
82
+
1 second and doubling per attempt, roughly two minutes of cumulative backoff
83
+
across the window. After the 8th failed attempt the event dead-letters
84
+
(`retry-limit-exceeded`) immediately: LINE opts out of the generic 24-hour
85
+
dead-letter age floor so a poison event cannot block its conversation lane for
86
+
a day.
87
+
-**Non-retryable failures.** These dead-letter immediately, with no further
88
+
retries regardless of the attempt count: stored payloads that no longer parse
89
+
(`invalid-event`), deliveries that already committed side effects
90
+
(`delivery-side-effects-committed`), and LINE API authentication failures
91
+
(`authentication-failed`, HTTP 401/403).
92
+
-**Stall watchdog.** A claimed delivery that neither reaches agent-turn adoption
93
+
nor reports continued deferred progress for 5 minutes is aborted and released
94
+
back to its lane through the same retry policy as any other failure: the event
95
+
returns to pending with its attempt count incremented and `handler-timeout`
96
+
recorded as its last error, and it keeps its place at the head of its lane. A
97
+
stall is not itself a dead letter — only the retry limit above ends the event,
98
+
as `retry-limit-exceeded`. The watchdog only covers the window between claim
99
+
and adoption: deferred progress re-arms it and adoption clears it, so a long
100
+
agent turn is never interrupted by it. Adoption that arrives after the
101
+
watchdog fires is fenced off, so a late turn cannot claim an event that has
102
+
already been handed back.
103
+
-**Crash recovery.** Every drain pass opens with a recovery sweep that reclaims
104
+
any claim whose owning Gateway process is no longer running, so a delivery lost
105
+
to a hard crash is retried on the next sweep rather than after a timeout. The
106
+
30-minute claim lease is the fallback bound for the opposite case: without a
107
+
successful lease refresh, it caps how long a claim stays protected solely
108
+
because its owner PID still looks alive — including a reused PID whose process
109
+
identity cannot be verified. Events accepted while the Gateway is stopping are
110
+
still persisted and drain after the next start.
111
+
-**Duplicate suppression window.** On every admission, LINE removes completed
112
+
and failed queue records older than 30 days, then keeps the most recently
113
+
updated 4096 records of each kind per account. Because pruning runs before the
114
+
new event is queued rather than on a timer, records can remain past 30 days on
115
+
an idle account, and a newly completed record can put the count above 4096 until
116
+
the next admission. While a record exists, a redelivered webhook for the same
117
+
event is acknowledged without a second dispatch; once it is gone — by age or by
118
+
cap — a redelivery is admitted and dispatched again, so handlers with external
119
+
side effects should not treat this window as a substitute for their own
120
+
idempotency.
121
+
122
+
The `500`-on-persistence-failure contract only helps if LINE re-sends the event.
123
+
LINE redelivers a webhook when **Webhook redelivery** is enabled for the channel in
124
+
the LINE Developers Console (Messaging API settings, alongside **Use webhook**) and
125
+
the bot server did not answer `2xx`. Without that setting, an event refused with
126
+
`500` is not re-sent. Even enabled, redelivery is best effort rather than a
127
+
guarantee: LINE documents that it is not reliable, that the retry count and
128
+
interval are undisclosed, and that redelivered events may arrive out of order or
129
+
more than once (the duplicate suppression window above absorbs the repeats). See
130
+
[Redeliver a webhook that failed to be received](https://developers.line.biz/en/docs/messaging-api/receiving-messages/#webhook-redelivery).
131
+
132
+
Dead-lettered events stay inspectable and, depending on the failure reason,
133
+
recoverable; see [Inbound dead letters](/cli/channels#inbound-dead-letters) and
134
+
[Troubleshooting](#troubleshooting) below.
135
+
64
136
## Configure
65
137
66
138
Minimal config:
@@ -306,6 +378,32 @@ Generic media sends without LINE-specific options use the image route.
306
378
and that the gateway is reachable from LINE.
307
379
-**Media download errors:** raise `channels.line.mediaMaxMb` if media exceeds the
0 commit comments