Skip to content

fix(slack): Socket Mode logs a warning for every ping from another undici copy - #164305

Merged
altaywtf merged 2 commits into
openclaw:mainfrom
jayzhou2309:fix/slack-ping-diagnostics-warn
Oct 5, 2026
Merged

altaywtf merged 2 commits into
openclaw:mainfrom
jayzhou2309:fix/slack-ping-diagnostics-warn

Conversation

@jayzhou2309

@jayzhou2309 jayzhou2309 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #164266

What Problem This Solves

Fixes: the Slack Socket Mode client logs Received unexpected ping diagnostics message format at WARN for every ping or pong frame from a WebSocket that another undici copy in the Gateway built. The report measured this at 19% of all Gateway log lines.

User Impact

User impact: Gateway logs no longer fill with this warning on installs where the Slack plugin and core load different undici copies. Socket health, heartbeat timeouts, and every other Socket Mode warning and error are unchanged.

Why This Change Was Made

@slack/socket-mode 3.0.1 subscribes each SlackWebSocket to undici's process-wide undici:websocket:ping and undici:websocket:pong diagnostics channels. It warns before it checks whether the frame belongs to its own socket, and its check is instanceof its own undici's WebSocket. Frames from any WebSocket built by another undici copy, such as core's, fail that check and warn instead of being ignored. Aligning undici versions would not cover every foreign constructor, since client-options.ts already resolves Socket Mode's own copy.

createSlackSocketModeLogger in extensions/slack/src/monitor/provider-support.ts already drops two known non-actionable SDK warnings (heartbeat timeouts and the ignored logLevel notice). It now drops these two exact diagnostics strings too. The SDK only emits them when a diagnostics message lacks its own WebSocket instance, and the handler returns without touching connection state, so nothing actionable is lost.

Evidence

  • Red first. test(slack) commit af61a97 adds the ping and pong diagnostics warnings to "filters Socket Mode noise and retains SDK errors through the configured receiver logger" in extensions/slack/src/monitor/provider.interop.test.ts. On upstream/main 4c0c0c0 it fails with expected "warn" to be called 1 times, but got 3 times. On fix 5ea15b6: 13/13 pass.
  • pnpm test extensions/slack/src/monitor/: 74 files, 1127 passed. pnpm tsgo:extensions exit 0. scripts/run-oxlint.mjs exit 0 and oxfmt --check clean on both changed files.
  • Real SDK through the production logger. A throwaway vitest probe (not committed) builds the receiver with createSlackBoltApp from the real @slack/bolt (socket mode, so the receiver logger is createSlackSocketModeLogger), then constructs the real SlackWebSocket from Bolt's own @slack/socket-mode 3.0.1 ([email protected]) with that receiver's logger. It connects to a local ws server alongside a second socket built by Node's bundled undici (a foreign WebSocket class), and the server sends a real ping and an unsolicited pong to both. The SDK socket's own frames are ignored as usual. The foreign socket's frames reach the SDK's diagnostics handlers. A later warn with an unrelated message checks that the logger still forwards everything else. console.warn captured on each side:
## main 4c0c0c0e3af
diagnostics published: {"ping":2,"pong":2}
console.warn lines: ["socket-mode:socket-mode Received unexpected ping diagnostics message format","socket-mode:socket-mode Received unexpected pong diagnostics message format","socket-mode:socket-mode unrelated socket warning"]

## fix 5ea15b6eca4
diagnostics published: {"ping":2,"pong":2}
console.warn lines: ["socket-mode:socket-mode unrelated socket warning"]

Not verified: a live Gateway with four Slack accounts connected to Slack over hours. The probe runs real frames through the real SDK and the production receiver logger against a local server, but the log-volume drop on a real install was not measured.

AI disclosure: an AI agent (Claude Code) traced the root cause in the Socket Mode SDK, wrote the test and the fix, and ran the gates above: pnpm test extensions/slack/src/monitor/provider.interop.test.ts --maxWorkers=1, pnpm test extensions/slack/src/monitor/, pnpm tsgo:extensions, scripts/run-oxlint.mjs, oxfmt --check, and the SDK boundary probe above.

🤖 Written and posted by an AI agent (Claude Code) on behalf of @jayzhou2309.

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: XS labels Oct 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 9:07 AM ET / 13:07 UTC (Revision 2).

ClawSweeper review

What this changes

The Slack plugin suppresses two exact foreign-WebSocket heartbeat warnings and extends its logger regression coverage.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary, and the updated production-logger trace resolves the previous proof blocker. No actionable correctness or security defect was found.

Priority: P2
Reviewed head: 5ea15b6eca48e63bc9c32fa75e38c0ed0e845663

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant production-boundary proof and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The updated trace exercises real SDK heartbeat frames through the logger supplied by createSlackBoltApp against a local WebSocket server: foreign ping/pong warnings disappear after the fix while an unrelated warning remains. This resolves the prior rank-up request; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The updated trace exercises real SDK heartbeat frames through the logger supplied by createSlackBoltApp against a local WebSocket server: foreign ping/pong warnings disappear after the fix while an unrelated warning remains. This resolves the prior rank-up request; no stored-data contract changes.
Evidence reviewed 10 items Pinned introduced change: The merge-base-to-head diff adds an anchored ping/pong warning filter to the existing logger and two inputs to its existing regression test. The host-verified test merge contains these same two changed paths.
Production logger boundary: Read the complete production module and interop test. createSlackBoltApp supplies this logger to SocketModeReceiver; unmatched warnings and all errors still reach their existing console sinks. The regression extends existing coverage without adding fixtures or production seams.
Dependency mechanism verified: The verified socket-mode 3.0.1 tag resolves to this commit. Its complete SlackWebSocket source requires its own undici WebSocket constructor, warns before comparing socket ownership, and returns before updating heartbeat state. This directly supports the patch’s dependency claim.
Findings None None.
Security None None.

How this fits together

Slack Socket Mode receives events over a persistent WebSocket. Its SDK sends diagnostics through OpenClaw’s receiver logger, which filters known noise before forwarding warnings and errors to Gateway logs.

flowchart TD
  A[Slack WebSocket] --> C[SDK heartbeat diagnostics]
  B[Other WebSockets] --> C
  C --> D[Socket Mode logger]
  D --> E{Known noise?}
  E -->|Yes| F[Suppress warning]
  E -->|No| G[Gateway logs]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +9, Tests +2. Total +11 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 1 +9
Tests 1 2 0 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 12 1 +11

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #164266
Summary: This PR is the candidate repair for the linked foreign-WebSocket warning report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep selective noise suppression at the existing Slack logger boundary while preserving socket health behavior and actionable diagnostics.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes the foreign-constructor diagnostics path, and the contributor supplies a matching before/after real-SDK trace; this reviewer did not execute it.

Is this the best way to solve the issue?

Yes, the exact-message filter extends the existing logger owner without changing transport behavior; dependency version alignment cannot cover all foreign constructors.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f965e0ea73ef.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The updated trace exercises real SDK heartbeat frames through the logger supplied by createSlackBoltApp against a local WebSocket server: foreign ping/pong warnings disappear after the fix while an unrelated warning remains. This resolves the prior rank-up request; no stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The updated trace exercises real SDK heartbeat frames through the logger supplied by createSlackBoltApp against a local WebSocket server: foreign ping/pong warnings disappear after the fix while an unrelated warning remains. This resolves the prior rank-up request; no stored-data contract changes.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The patch addresses substantial operator log noise without a reported delivery or availability failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The updated trace exercises real SDK heartbeat frames through the logger supplied by createSlackBoltApp against a local WebSocket server: foreign ping/pong warnings disappear after the fix while an unrelated warning remains. This resolves the prior rank-up request; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The updated trace exercises real SDK heartbeat frames through the logger supplied by createSlackBoltApp against a local WebSocket server: foreign ping/pong warnings disappear after the fix while an unrelated warning remains. This resolves the prior rank-up request; no stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head diff adds an anchored ping/pong warning filter to the existing logger and two inputs to its existing regression test. The host-verified test merge contains these same two changed paths. (extensions/slack/src/monitor/provider-support.ts:292, 5ea15b6eca48)
  • Production logger boundary: Read the complete production module and interop test. createSlackBoltApp supplies this logger to SocketModeReceiver; unmatched warnings and all errors still reach their existing console sinks. The regression extends existing coverage without adding fixtures or production seams. (extensions/slack/src/monitor/provider.interop.test.ts:146, 5ea15b6eca48)
  • Dependency mechanism verified: The verified socket-mode 3.0.1 tag resolves to this commit. Its complete SlackWebSocket source requires its own undici WebSocket constructor, warns before comparing socket ownership, and returns before updating heartbeat state. This directly supports the patch’s dependency claim. (packages/socket-mode/src/SlackWebSocket.ts:199, e0fa7455eedf)
  • Existing dependency configuration is insufficient: client-options.ts deliberately resolves Socket Mode’s own undici copy and supports separate constructor identities. Matching package versions therefore does not eliminate every foreign WebSocket source. (extensions/slack/src/client-options.ts:69, 5ea15b6eca48)
  • Updated real behavior proof: The captured body snapshot, sourceRevision 47a43902087f687010232146cdcc751bc8137c8b81672abfee7e01f3262bcca3, describes real Bolt receiver construction and real SlackWebSocket traffic against a local ws server alongside Node’s foreign WebSocket constructor. Both revisions published two ping and two pong diagnostics; main logged both unexpected-format warnings plus an unrelated warning, while the fixed head logged only the unrelated warning. This satisfies the previous requested production-logger trace. Multi-account Slack log-volume reduction over hours was explicitly not measured. (5ea15b6eca48)
  • Current main still needs the fix: Fetched current-main source retains only the heartbeat-timeout and ignored-log-level exclusions; these diagnostic warnings still reach console.warn. (extensions/slack/src/monitor/provider-support.ts:280, f965e0ea73ef)

Likely related people:

  • Peter Steinberger: Raw commit 457ab1e adds extensions/slack/src/monitor/provider-support.ts:288 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 457ab1e17086; files: extensions/slack/src/monitor/provider-support.ts)
  • calinilie: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-03T12:53:06.896Z sha 5ea15b6 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 3, 2026

@altaywtf altaywtf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reproduced this on main and verified 5ea15b6e. No actionable findings.

  • Real ping/pong frames through the production receiver logger produce both warnings on main; this head removes them. Reverting the fix restores both.
  • Owned heartbeat state, other warnings, near-match messages and errors remain intact. The focused logger, reconnect and envelope tests pass.
  • I did not measure a live multi-account Slack Gateway or production log-volume reduction.

@altaywtf
altaywtf merged commit f0d34cb into openclaw:main Oct 5, 2026
124 checks passed
@altaywtf

altaywtf commented Oct 5, 2026

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…dici copy (openclaw#164305)

* test(slack): cover foreign undici ping diagnostics warnings

* fix(slack): drop foreign undici ping diagnostics warnings

---------

Co-authored-by: Jay Zhou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack socket-mode logs a WARN per ping frame from foreign undici instances (19% of gateway log lines)

2 participants