openclaw/src/discord
Glucksberg 481bd333eb
fix(gateway): gracefully handle AbortError and transient network errors (#2451)
* fix(tts): generate audio when block streaming drops final reply

When block streaming succeeds, final replies are dropped but TTS was only
applied to final replies. Fix by accumulating block text during streaming
and generating TTS-only audio after streaming completes.

Also:
- Change truncate vs skip behavior when summary OFF (now truncates)
- Align TTS limits with Telegram max (4096 chars)
- Improve /tts command help messages with examples
- Add newline separator between accumulated blocks

* fix(tts): add error handling for accumulated block TTS

* feat(tts): add descriptive inline menu with action descriptions

- Add value/label support for command arg choices
- TTS menu now shows descriptive title listing each action
- Capitalize button labels (On, Off, Status, etc.)
- Update Telegram, Discord, and Slack handlers to use labels

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(gateway): gracefully handle AbortError and transient network errors

Addresses issues #1851, #1997, and #2034.

During config reload (SIGUSR1), in-flight requests are aborted, causing
AbortError exceptions. Similarly, transient network errors (fetch failed,
ECONNRESET, ETIMEDOUT, etc.) can crash the gateway unnecessarily.

This change:
- Adds isAbortError() to detect intentional cancellations
- Adds isTransientNetworkError() to detect temporary connectivity issues
- Logs these errors appropriately instead of crashing
- Handles nested cause chains and AggregateError

AbortError is logged as a warning (expected during shutdown).
Network errors are logged as non-fatal errors (will resolve on their own).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(test): update commands-registry test expectations

Update test expectations to match new ResolvedCommandArgChoice format
(choices now return {label, value} objects instead of plain strings).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: harden unhandled rejection handling and tts menus (#2451) (thanks @Glucksberg)

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Shadow <hi@shadowing.dev>
2026-01-26 19:51:53 -06:00
..
monitor fix(gateway): gracefully handle AbortError and transient network errors (#2451) 2026-01-26 19:51:53 -06:00
accounts.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
api.test.ts fix: harden discord rate-limit handling 2026-01-24 08:43:28 +00:00
api.ts fix: harden discord rate-limit handling 2026-01-24 08:43:28 +00:00
audit.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
audit.ts fix: surface match metadata in audits and slack logs 2026-01-18 00:50:36 +00:00
chunk.test.ts fix: paragraph-aware newline chunking (#1726) 2026-01-25 13:24:19 +00:00
chunk.ts fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
directory-live.ts refactor: centralize discord api errors 2026-01-20 17:28:19 +00:00
gateway-logging.test.ts chore(discord): restore gateway log context 2026-01-13 04:40:22 +00:00
gateway-logging.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
index.ts feat: unify poll support 2026-01-06 04:51:05 +00:00
monitor.gateway.test.ts Discord: harden gateway resilience 2026-01-08 16:52:44 -06:00
monitor.gateway.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
monitor.slash.test.ts feat(discord): add configurable privileged Gateway Intents (GuildPresences, GuildMembers) (#2266) 2026-01-26 10:39:54 -06:00
monitor.test.ts fix(discord): autoThread ack reactions + exec approval null handling (#1511) 2026-01-23 20:01:15 +00:00
monitor.tool-result.accepts-guild-messages-mentionpatterns-match.test.ts test: cover explicit mention gating across channels 2026-01-24 11:09:33 +00:00
monitor.tool-result.sends-status-replies-responseprefix.test.ts fix: unify inbound dispatch pipeline 2026-01-23 22:58:54 +00:00
monitor.ts refactor(channels): share channel config matching 2026-01-17 23:03:51 +00:00
probe.intents.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
probe.ts fix: normalize abort signals for fetch 2026-01-21 17:29:46 +00:00
resolve-channels.test.ts feat(channels): add resolve command + defaults 2026-01-18 01:00:24 +00:00
resolve-channels.ts refactor: centralize discord api errors 2026-01-20 17:28:19 +00:00
resolve-users.ts refactor: centralize discord api errors 2026-01-20 17:28:19 +00:00
send.channels.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.creates-thread.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.emojis-stickers.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.guild.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.messages.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.outbound.ts fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
send.permissions.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.reactions.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.sends-basic-channel-messages.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.shared.ts fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
send.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.types.ts refactor(discord): split send pipeline 2026-01-14 05:39:55 +00:00
targets.test.ts refactor(channels): unify target parsing 2026-01-18 00:31:42 +00:00
targets.ts refactor(channels): unify target parsing 2026-01-18 00:31:42 +00:00
token.test.ts fix: prefer config tokens over env for discord/telegram 2026-01-16 23:13:00 +00:00
token.ts fix: prefer config tokens over env for discord/telegram 2026-01-16 23:13:00 +00:00