Skip to content

Commit a54b858

Browse files
graysurfTakhoffman
andauthored
Handle transient Slack request errors without crashing the gateway (openclaw#23787) thanks @graysurf
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: graysurf <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
1 parent bd78a74 commit a54b858

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Docs: https://docs.openclaw.ai
9494
- Cron/Schedule errors: notify users when a job is auto-disabled after repeated schedule computation failures. (#29098) Thanks .
9595
- File tools/tilde paths: expand `~/...` against the user home directory before workspace-root checks in host file read/write/edit paths, while preserving root-boundary enforcement so outside-root targets remain blocked. (#29779) Thanks @Glucksberg.
9696
- Slack/HTTP mode startup: treat Slack HTTP accounts as configured when `botToken` + `signingSecret` are present (without requiring `appToken`) in channel config/runtime status so webhook mode is not silently skipped. (#30567)
97+
- Slack/Transient request errors: classify Slack request-error messages like `Client network socket disconnected before secure TLS connection was established` as transient in unhandled-rejection fatal detection, preventing temporary network drops from crash-looping the gateway. (#23169)
9798
- Slack/Usage footer formatting: wrap session keys in inline code in full response-usage footers so Slack does not parse colon-delimited session segments as emoji shortcodes. (#30258) Thanks @pushkarsingh32.
9899
- Slack/Socket Mode slash startup: treat `app.options()` registration as best-effort and fall back to static arg menus when listener registration fails, preventing Slack monitor startup crash loops on receiver init edge cases. (#21715)
99100
- Slack/Legacy streaming config: map boolean `channels.slack.streaming=false` to unified streaming mode `off` (with `nativeStreaming=false`) so legacy configs correctly disable draft preview/native streaming instead of defaulting to `partial`. (#25990) Thanks @chilu18.

src/infra/unhandled-rejections.fatal-detection.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,22 @@ describe("installUnhandledRejectionHandler - fatal detection", () => {
9393
Object.assign(new Error("DNS resolve failed"), { code: "UND_ERR_DNS_RESOLVE_FAILED" }),
9494
Object.assign(new Error("Connection reset"), { code: "ECONNRESET" }),
9595
Object.assign(new Error("Timeout"), { code: "ETIMEDOUT" }),
96+
Object.assign(
97+
new Error(
98+
"A request error occurred: Client network socket disconnected before secure TLS connection was established",
99+
),
100+
{ code: "slack_webapi_request_error" },
101+
),
96102
Object.assign(new Error("A request error occurred: getaddrinfo EAI_AGAIN slack.com"), {
97103
code: "slack_webapi_request_error",
98104
original: { code: "EAI_AGAIN", syscall: "getaddrinfo", hostname: "slack.com" },
99105
}),
106+
Object.assign(new Error("A request error occurred: unknown"), {
107+
code: "slack_webapi_request_error",
108+
original: Object.assign(new Error("connect timeout"), {
109+
code: "UND_ERR_CONNECT_TIMEOUT",
110+
}),
111+
}),
100112
];
101113

102114
for (const transientErr of transientCases) {
@@ -119,6 +131,17 @@ describe("installUnhandledRejectionHandler - fatal detection", () => {
119131
);
120132
});
121133

134+
it("exits on non-transient Slack request errors", () => {
135+
const slackErr = Object.assign(
136+
new Error("A request error occurred: invalid request payload"),
137+
{
138+
code: "slack_webapi_request_error",
139+
},
140+
);
141+
142+
expectExitCodeFromUnhandled(slackErr, [1]);
143+
});
144+
122145
it("does not exit on AbortError and logs suppression warning", () => {
123146
const abortErr = new Error("This operation was aborted");
124147
abortErr.name = "AbortError";

src/infra/unhandled-rejections.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const TRANSIENT_NETWORK_MESSAGE_CODE_RE =
4949
const TRANSIENT_NETWORK_MESSAGE_SNIPPETS = [
5050
"getaddrinfo",
5151
"socket hang up",
52+
"client network socket disconnected before secure tls connection was established",
5253
"network error",
5354
"network is unreachable",
5455
"temporary failure in name resolution",

0 commit comments

Comments
 (0)