























@@ -116,29 +116,25 @@ function resolveStableSlackUserAllowlistEntries(entries: string[]): SlackUserRes
116116export function formatSlackSocketReconnectMessage(params: {
117117event: string;
118118attempt: number;
119-maxAttempts: number;
120119delayMs: number;
121120error?: unknown;
122121}) {
123-const maxAttempts = params.maxAttempts > 0 ? String(params.maxAttempts) : "∞";
124122const suffix = params.error ? ` (${formatUnknownError(params.error)})` : "";
125-return `slack socket disconnected (${params.event}); reconnecting in ${Math.round(params.delayMs / 1000)}s (attempt ${params.attempt}/${maxAttempts})${suffix}`;
123+return `slack socket disconnected (${params.event}); reconnecting in ${Math.round(params.delayMs / 1000)}s (attempt ${params.attempt}/∞)${suffix}`;
126124}
127125128126export function formatSlackSocketStartRetryMessage(params: {
129127attempt: number;
130-maxAttempts: number;
131128delayMs: number;
132129error: unknown;
133130sdkContext?: string;
134131}) {
135-const maxAttempts = params.maxAttempts > 0 ? String(params.maxAttempts) : "∞";
136132const reason = formatUnknownError(
137133params.error,
138134"Slack Socket Mode start failed without error detail",
139135);
140136const sdkContext = params.sdkContext?.trim() ? `; last SDK log: ${params.sdkContext.trim()}` : "";
141-return `slack socket mode failed to start; retry ${params.attempt}/${maxAttempts} in ${Math.round(params.delayMs / 1000)}s reason="${reason}${sdkContext}"`;
137+return `slack socket mode failed to start; retry ${params.attempt}/∞ in ${Math.round(params.delayMs / 1000)}s reason="${reason}${sdkContext}"`;
142138}
143139144140function parseApiAppIdFromAppToken(raw?: string) {
@@ -568,7 +564,7 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) {
568564}
569565publishSlackDisconnectedStatus(opts.setStatus, disconnect.error);
570566571-// Bail immediately on non-recoverable auth errors during reconnect too.
567+// Permanent account and credential failures need operator action.
572568if (disconnect.error && isNonRecoverableSlackAuthError(disconnect.error)) {
573569runtime.error?.(
574570`slack socket mode disconnected due to non-recoverable auth error — skipping channel (${formatUnknownError(disconnect.error)})`,
@@ -579,22 +575,12 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) {
579575}
580576581577reconnectAttempts += 1;
582-if (
583-SLACK_SOCKET_RECONNECT_POLICY.maxAttempts > 0 &&
584-reconnectAttempts >= SLACK_SOCKET_RECONNECT_POLICY.maxAttempts
585-) {
586-throw new Error(
587-`Slack socket mode reconnect max attempts reached (${reconnectAttempts}/${SLACK_SOCKET_RECONNECT_POLICY.maxAttempts}) after ${disconnect.event}`,
588-);
589-}
590-591578const delayMs = computeBackoff(SLACK_SOCKET_RECONNECT_POLICY, reconnectAttempts);
592579runtime.log?.(
593580warn(
594581formatSlackSocketReconnectMessage({
595582event: disconnect.event,
596583attempt: reconnectAttempts,
597-maxAttempts: SLACK_SOCKET_RECONNECT_POLICY.maxAttempts,
598584 delayMs,
599585error: disconnect.error,
600586}),
@@ -607,26 +593,17 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) {
607593break;
608594}
609595} catch (err) {
610-// Auth errors (account_inactive, invalid_auth, etc.) are permanent —
611-// retrying will never succeed and blocks the entire gateway. Fail fast.
612596if (isNonRecoverableSlackAuthError(err)) {
613597runtime.error?.(
614598`slack socket mode failed to start due to non-recoverable auth error — skipping channel (${formatUnknownError(err)})`,
615599);
616600throw err;
617601}
618602reconnectAttempts += 1;
619-if (
620-SLACK_SOCKET_RECONNECT_POLICY.maxAttempts > 0 &&
621-reconnectAttempts >= SLACK_SOCKET_RECONNECT_POLICY.maxAttempts
622-) {
623-throw err;
624-}
625603const delayMs = computeBackoff(SLACK_SOCKET_RECONNECT_POLICY, reconnectAttempts);
626604runtime.error?.(
627605formatSlackSocketStartRetryMessage({
628606attempt: reconnectAttempts,
629-maxAttempts: SLACK_SOCKET_RECONNECT_POLICY.maxAttempts,
630607 delayMs,
631608error: err,
632609sdkContext: socketModeLogger.getLastMessage(),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。