Skip to content

Commit a6ccf6a

Browse 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]>
1 parent efb04e0 commit a6ccf6a

1 file changed

Lines changed: 103 additions & 5 deletions

File tree

‎docs/channels/line.md‎

Lines changed: 103 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ openclaw plugins install ./path/to/local/line-plugin
4242
https://gateway-host/line/webhook
4343
```
4444

45-
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
5051
`500` instead of acknowledging an event that could be lost.
5152
Delivery is at least once across the queue-to-agent boundary: a Gateway shutdown or
5253
crash during an active delivery can replay the turn. Message events deduplicate by
@@ -61,6 +62,77 @@ Security notes:
6162
- 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.
6263
- OpenClaw processes webhook events from the verified raw request bytes. Upstream middleware-transformed `req.body` values are ignored for signature-integrity safety.
6364

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+
64136
## Configure
65137

66138
Minimal config:
@@ -306,6 +378,32 @@ Generic media sends without LINE-specific options use the image route.
306378
and that the gateway is reachable from LINE.
307379
- **Media download errors:** raise `channels.line.mediaMaxMb` if media exceeds the
308380
default limit.
381+
- **Bot silently skips messages (events dead-lettered):** `openclaw logs` shows
382+
`line: spooled update <id> ... dead-lettered` lines with the failure reason.
383+
Inspect with `openclaw channels dead-letters list --channel line --account default`
384+
and check the failure reason before recovering: `resubmit` re-enqueues by event
385+
id without checking why the event failed. After fixing the cause of a failure
386+
with no committed side effects (for example `retry-limit-exceeded` after a
387+
provider outage), re-enqueue one event with
388+
`openclaw channels dead-letters resubmit <event-id> --channel line --account default`.
389+
Never resubmit a `delivery-side-effects-committed` event: that reason means the
390+
delivery already adopted an agent turn or consumed its reply token, so
391+
re-enqueuing repeats the committed work — for example a second visible reply.
392+
`openclaw health` reports dead-letter counts and `openclaw doctor` names
393+
affected accounts.
394+
- **`handler-timeout` retries:** the delivery was claimed but neither reached
395+
agent-turn adoption nor reported deferred progress for 5 minutes. This is a
396+
stall _before_ the turn starts —
397+
adoption clears the watchdog, so a turn that is already running is never the
398+
cause and is never cut off by it. Look at the dispatch path instead: the
399+
delivery preparation that runs between claim and adoption, such as inbound
400+
media download or a Gateway that is not accepting new work. This does not
401+
dead-letter the event; `openclaw logs` shows
402+
`applying retry policy (handler-timeout)` and the event waits out its backoff
403+
with `handler-timeout` as its last error. A stall that keeps repeating is what
404+
eventually exhausts the retry limit, so an event that stalls its way to a dead
405+
letter lands under `retry-limit-exceeded`, not under a timeout reason. Check
406+
`openclaw logs --follow` around the affected event id.
309407

310408
## Related
311409

0 commit comments

Comments
 (0)