fix(slack): remove socket reconnect attempt cap so gateway stays connected indefinitely#73162
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Unlimited Slack socket reconnect attempts when maxAttempts set to 0 (resource-exhaustion DoS)
Description
In
Vulnerable logic (cap disabled when maxAttempts is 0): if (SLACK_SOCKET_RECONNECT_POLICY.maxAttempts > 0 &&
reconnectAttempts >= SLACK_SOCKET_RECONNECT_POLICY.maxAttempts) {
throw new Error("...max attempts reached...");
}RecommendationReintroduce a finite reconnect cap, or implement an explicit circuit breaker/disable flag instead of using Option A (simple): restore a reasonable cap (e.g., 12): export const SLACK_SOCKET_RECONNECT_POLICY = {
initialMs: 2_000,
maxMs: 30_000,
factor: 1.8,
jitter: 0.25,
maxAttempts: 12,
} as const;Option B (explicit unlimited + safety): if unlimited retries are desired, add safeguards such as:
Example duration cap (pseudo): const startedAt = Date.now();
const MAX_RETRY_WINDOW_MS = 10 * 60_000;
...
if (Date.now() - startedAt > MAX_RETRY_WINDOW_MS) throw new Error("reconnect window exceeded");Analyzed PR: #73162 at commit Last updated on: 2026-04-28T02:09:23Z |
Greptile SummaryThis PR changes Confidence Score: 5/5Safe to merge — minimal one-line change with well-understood semantics already supported by the existing consumer code. The change is a single-field update to a policy constant. The consuming code in provider.ts already explicitly handles No files require special attention. Reviews (1): Last reviewed commit: "fix(slack): remove socket reconnect atte..." | Re-trigger Greptile |
|
CI failures ( |
|
@suboss87 I posted more details of the logs I am seeing here: #72808 (comment) - let me know anything else you want me to collect |
|
Thanks for the detailed trace @tleyden. Your analysis is exactly right. The throw at This PR flips Your logs confirm the reproduction. Nothing else needed from you, this is ready for maintainer review. |
|
Codex review: needs real behavior proof before merge. Reviewed June 17, 2026, 11:25 AM ET / 15:25 UTC. Summary PR surface: Source 0, Docs +1. Total +1 across 2 files. Reproducibility: yes. at source level: current main still has the 12-attempt Slack Socket Mode cap and throws when reconnect attempts reach it, and the linked issue includes matching logs. I did not run a live Slack disconnect sequence in this read-only review. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a narrow Slack plugin fix that removes or revises the recoverable Socket Mode cap, preserves non-recoverable auth fail-fast behavior, updates Slack operator docs, removes the release-owned changelog edit, and includes real reconnect proof for the chosen recovery policy. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main still has the 12-attempt Slack Socket Mode cap and throws when reconnect attempts reach it, and the linked issue includes matching logs. I did not run a live Slack disconnect sequence in this read-only review. Is this the best way to solve the issue? No as submitted: the one-line runtime change is the narrow owner-boundary fix for the finite-cap failure, but docs, release-owned changelog, real behavior proof, and maintainer recovery-policy acceptance remain before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a7f96847ce2d. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Docs +1. Total +1 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Static review. CI authoritative. The Load-bearing on Does not address process restart after non-exhaustion exits (panic, unhandled rejection in the socket-mode worker). Out-of-scope per PR body — separate supervisor concern. Corroborating field evidence: downgrade to 2026.4.14 / 2026.4.23 restores prior behavior; truiem-bot's LGTM. |
|
@suboss87 any update on this PR? How can I help? |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Maintainer preparation complete. Proof:
The full local test suite completed with unrelated baseline failures in gateway, plugin-SDK reporting, infra/state platform assumptions, secrets timeout cleanup, and tooling timeout cleanup. No Slack test failed; the Slack shard and remote changed-surface validation are green. Prepared head: |
…ected indefinitely
Recover recoverable Socket Mode failures indefinitely while preserving SDK fail-fast errors. Add monitor-level regression proof and align the Slack documentation. Fixes openclaw#72808
Keep Slack Web API request and HTTP failures in the reconnect loop while preserving fail-fast handling for permanent account and credential errors.
|
Merged via squash.
Thanks @suboss87! |
Summary
Fixes #72808
Verification
pnpm buildpnpm checknode scripts/run-vitest.mjs extensions/slack/src/monitor/provider.reconnect-loop.test.ts extensions/slack/src/monitor/provider.reconnect.test.ts extensions/slack/src/monitor/provider.auth-errors.test.ts extensions/slack/src/monitor/provider.interop.test.ts extensions/slack/src/monitor/provider.allowlist.test.ts— 5 files, 61 tests passednode scripts/check-docs-mdx.mjs docs README.md— 679 files passedrun_1a5e8fdab015Real behavior proof
Behavior addressed: Recoverable Slack Socket Mode failures continue reconnecting beyond the former 12-attempt limit while permanent account and credential failures stop immediately.
Real environment tested: Azure Linux validation host plus the local Node 24 maintainer checkout.
Exact steps or command run after this patch: Ran the focused Slack monitor tests above and the repository changed-surface validation.
Evidence after fix: The reconnect-loop regression reaches attempt 13 for raw network, Slack Web API request, and HTTP 503 failures and then reconnects successfully; all 61 focused Slack tests passed.
Observed result after fix: Recoverable failures remain retryable and abortable; permanent Slack account and credential errors fail fast.
What was not tested: No live Slack workspace disconnect was forced. The full local suite completed with unrelated baseline failures outside the Slack surface; build, static checks, the Slack shard, docs validation, and remote changed-surface validation passed.