openclaw/src/auto-reply
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
..
reply fix(gateway): gracefully handle AbortError and transient network errors (#2451) 2026-01-26 19:51:53 -06:00
chunk.test.ts fix: paragraph-aware newline chunking (#1726) 2026-01-25 13:24:19 +00:00
chunk.ts fix: paragraph-aware newline chunking (#1726) 2026-01-25 13:24:19 +00:00
command-auth.ts fix(security): gate slash/control commands 2026-01-17 06:49:34 +00:00
command-control.test.ts test: consolidate auto-reply unit coverage 2026-01-23 18:34:33 +00:00
command-detection.ts refactor(security): harden CommandAuthorized plumbing 2026-01-17 10:19:34 +00:00
commands-args.ts fix: lint errors 2026-01-15 17:08:31 +00:00
commands-registry.data.ts fix(gateway): gracefully handle AbortError and transient network errors (#2451) 2026-01-26 19:51:53 -06:00
commands-registry.test.ts fix(gateway): gracefully handle AbortError and transient network errors (#2451) 2026-01-26 19:51:53 -06:00
commands-registry.ts fix(gateway): gracefully handle AbortError and transient network errors (#2451) 2026-01-26 19:51:53 -06:00
commands-registry.types.ts fix(gateway): gracefully handle AbortError and transient network errors (#2451) 2026-01-26 19:51:53 -06:00
dispatch.ts fix: complete inbound dispatch refactor 2026-01-23 22:58:54 +00:00
envelope.test.ts fix: default envelope timestamps to local 2026-01-22 04:10:06 +00:00
envelope.ts fix: default envelope timestamps to local 2026-01-22 04:10:06 +00:00
group-activation.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
heartbeat.test.ts feat(heartbeat): skip API calls when HEARTBEAT.md is effectively empty (#1535) 2026-01-24 04:19:01 +00:00
heartbeat.ts feat: audit fixes and documentation improvements (#1762) 2026-01-25 12:54:48 +00:00
inbound-debounce.ts feat(queue): add per-channel debounce overrides 2026-01-21 18:50:55 +00:00
inbound.test.ts test: consolidate auto-reply unit coverage 2026-01-23 18:34:33 +00:00
media-note.test.ts refactor: tighten media diagnostics 2026-01-17 07:27:38 +00:00
media-note.ts refactor: tighten media diagnostics 2026-01-17 07:27:38 +00:00
model.test.ts Fix models command (#1753) 2026-01-25 10:02:12 +00:00
model.ts Fix models command (#1753) 2026-01-25 10:02:12 +00:00
reply.block-streaming.test.ts fix: honor gateway env token for doctor/security 2026-01-23 03:16:52 +00:00
reply.directive.directive-behavior.accepts-thinking-xhigh-codex-models.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.applies-inline-reasoning-mixed-messages-acks-immediately.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.defaults-think-low-reasoning-capable-models-no.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.ignores-inline-model-uses-default-model.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.lists-allowlisted-models-model-list.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.prefers-alias-matches-fuzzy-selection-is-ambiguous.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.requires-per-agent-allowlist-addition-global.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.returns-status-alongside-directive-only-acks.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.shows-current-elevated-level-as-off-after.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.shows-current-verbose-level-verbose-has-no.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.supports-fuzzy-model-matches-model-directive.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.directive-behavior.updates-tool-verbose-during-flight-run-toggle.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.directive.parse.test.ts feat: add elevated ask/full modes 2026-01-22 05:41:11 +00:00
reply.heartbeat-typing.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.media-note.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.queue.test.ts feat: enhance BlueBubbles media and message handling by adding reply context support and improving outbound message ID tracking 2026-01-20 12:07:54 +00:00
reply.raw-body.test.ts fix: normalize session keys and outbound mirroring 2026-01-24 11:57:11 +00:00
reply.triggers.group-intro-prompts.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.allows-activation-from-allowfrom-groups.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.allows-approved-sender-toggle-elevated-mode.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.allows-elevated-off-groups-without-mention.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.filters-usage-summary-current-model-provider.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.handles-inline-commands-strips-it-before-agent.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.ignores-inline-elevated-directive-unapproved-sender.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.includes-error-cause-embedded-agent-throws.e2e.test.ts fix: add log hint for agent failure (#1550) (thanks @sweepies) 2026-01-24 02:56:38 +00:00
reply.triggers.trigger-handling.keeps-inline-status-unauthorized-senders.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.reports-active-auth-profile-key-snippet-status.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.runs-compact-as-gated-command.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.runs-greeting-prompt-bare-reset.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.shows-endpoint-default-model-status-not-configured.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.shows-quick-model-picker-grouped-by-model.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.stages-inbound-media-into-sandbox-workspace.test.ts test: consolidate auto-reply unit coverage 2026-01-23 18:34:33 +00:00
reply.triggers.trigger-handling.targets-active-session-native-stop.e2e.test.ts test: move auto-reply directive coverage to e2e 2026-01-23 18:34:33 +00:00
reply.ts feat: add /exec session overrides 2026-01-18 06:12:54 +00:00
send-policy.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
skill-commands.test.ts fix: add /skill fallback for native limits 2026-01-20 13:20:29 +00:00
skill-commands.ts fix: add /skill fallback for native limits 2026-01-20 13:20:29 +00:00
status.test.ts refactor: centralize sandbox runtime label 2026-01-21 09:07:21 +00:00
status.ts feat: Add Line plugin (#1630) 2026-01-25 12:22:36 +00:00
templating.ts Add link understanding tool support (#1637) 2026-01-25 00:15:54 +00:00
thinking.test.ts fix: align ZAI thinking toggles 2026-01-16 22:26:43 +00:00
thinking.ts fix(telegram): honor linkPreview on fallback (#1730) 2026-01-25 07:55:39 +00:00
tokens.ts feat: add provider-specific tool policies 2026-01-15 03:55:20 +00:00
tool-meta.test.ts fix: improve tool summaries 2026-01-23 01:00:24 +00:00
tool-meta.ts fix: format exec elevated flag first in tool summaries 2026-01-17 21:54:24 +00:00
types.ts feat: Add Line plugin (#1630) 2026-01-25 12:22:36 +00:00