Skip to content

fix: improve Socket Mode client stability and correctness - #1854

Merged
WilliamBergamin merged 3 commits into
mainfrom
imporve-socket-mode
Apr 10, 2026
Merged

fix: improve Socket Mode client stability and correctness#1854
WilliamBergamin merged 3 commits into
mainfrom
imporve-socket-mode

Conversation

@WilliamBergamin

Copy link
Copy Markdown
Contributor

Summary

These changes aim to improve the stability and correctness of socket-mode client, the issues were mainly found using AI tools and confirmed by human to be legitimate.

This does not introduce any behavior change to the project

Testing

CI testing should be sufficient

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

@codecov

codecovBot commented Apr 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.01%. Comparing base (067560a) to head (2787042).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing linesPatch %Lines
slack_sdk/socket_mode/builtin/internals.py50.00%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #1854 +/- ##
==========================================
+ Coverage 83.99% 84.01% +0.01% 
==========================================
Files 117 117 Lines 13253 13256 +3 ==========================================
+ Hits 11132 11137 +5 + Misses 2121 2119 -2 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@srtaalejsrtaalej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM ⭐ but looks like you have some unit tests failing - i left a comment with a potench solution?

def test_connect_to_new_endpoint_does_not_release_lock_on_acquisition_timeout(self):
client = BaseSocketModeClient.__new__(BaseSocketModeClient)
client.logger = self.logger
client.connect_operation_lock = create_autospec(Lock(), acquire=MagicMock(return_value=False))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks like this is where unit tests are failing. this is the fix according to claude

Suggested change
client.connect_operation_lock=create_autospec(Lock(), acquire=MagicMock(return_value=False))
mock_lock=create_autospec(Lock())
mock_lock.acquire.return_value=False
client.connect_operation_lock=mock_lock

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Thats spot on 💯 thanks for sharing the solution 🥇

@WilliamBergamin
WilliamBergamin merged commit aa3a16d into mainApr 10, 2026
18 checks passed
@WilliamBergamin
WilliamBergamin deleted the imporve-socket-mode branch April 10, 2026 15:05
@WilliamBergamin
WilliamBergamin restored the imporve-socket-mode branch April 23, 2026 14:17
@zimegzimeg added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Version: 3x labels May 18, 2026
@WilliamBergamin
WilliamBergamin deleted the imporve-socket-mode branch June 2, 2026 15:55
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedsemver:patchsocket-modeVersion: 3x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@WilliamBergamin@srtaalej@zimeg