Skip to content

fix(gateway): prevent scoped lock and resource leaks on connection failure - #12916

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-adae552e
Apr 20, 2026
Merged

teknium1 merged 1 commit into
mainfrom
hermes/hermes-adae552e

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Salvage of #12420 by @Ruzzgar onto current main.

Slack/Signal/WhatsApp adapters now release the scoped platform lock (plus Signal's httpx client and WhatsApp's bridge-log handle) when connect() fails partway through, so in-process retries are no longer rejected as "already in use".

Changes

  • gateway/platforms/signal.py: lock_acquired flag + try/finally; also closes httpx.AsyncClient on health-check failure
  • gateway/platforms/slack.py: try/finally releases lock when auth_test() or Socket Mode setup raises
  • gateway/platforms/whatsapp.py: unified failure paths — finally closes bridge log FH and releases lock
  • Regression tests for each platform simulating the partial-failure path

Validation

PR's 3 new tests pass: TestSignalConnectCleanup, TestSlackConnectCleanup, TestConnectCleanup (WhatsApp).

Cherry-picked cleanly onto current main (141 commits ahead of the original branch point). Original authorship preserved.

Closes #12420.

@teknium1
teknium1 merged commit f23123e into main Apr 20, 2026
3 of 4 checks passed
@teknium1
teknium1 deleted the hermes/hermes-adae552e branch April 20, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants