Skip to content

fix: improve Socket Mode client stability and correctness#1854

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

fix: improve Socket Mode client stability and correctness#1854
WilliamBergamin merged 3 commits intomainfrom
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.

@WilliamBergamin WilliamBergamin added this to the 3.41.1 milestone Apr 9, 2026
@WilliamBergamin WilliamBergamin self-assigned this Apr 9, 2026
@WilliamBergamin WilliamBergamin requested a review from a team as a code owner April 9, 2026 18:58
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

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 lines Patch % Lines
slack_sdk/socket_mode/builtin/internals.py 50.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.

Copy link
Copy Markdown
Contributor

@srtaalej srtaalej left a comment

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
Contributor Author

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 main Apr 10, 2026
18 checks passed
@WilliamBergamin WilliamBergamin deleted the imporve-socket-mode branch April 10, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants