Skip to content

[WIP] ## Bug Slack bot receives Socket Mode events but messages never reach C#296

Closed
bamdadd wants to merge 1 commit into
mainfrom
lintel/fix/d9b649c5-bug-slack-bot-receives-socket-mode-event
Closed

[WIP] ## Bug Slack bot receives Socket Mode events but messages never reach C#296
bamdadd wants to merge 1 commit into
mainfrom
lintel/fix/d9b649c5-bug-slack-bot-receives-socket-mode-event

Conversation

@bamdadd

@bamdadd bamdadd commented Apr 7, 2026

Copy link
Copy Markdown
Owner

⚠️ This is a draft PR created by Lintel after a pipeline failure.
The automated workflow could not complete successfully. An engineer should review the changes, fix any issues, and mark the PR as ready.

Summary

Fix silent message drop in Slack Socket Mode by injecting team_id from the Bolt body envelope into the inner event dict inside the handle_message handler, and add tests covering injection, no-overwrite, and missing-team-id branches.

Changes

  • Inject team_id from body envelope into event dict in socket_listener.py
  • Add tests for team_id injection in test_socket_listener.py

Context

Bug

Slack bot receives Socket Mode events but messages never reach ChatService. No conversation is created and no reply is sent. Telegram works fine.

Root Cause

translate_message_event() in packages/slack/src/lintel/slack/event_translator.py:24 requires event.get("team") to be present:

if not all([thread_ts, channel_id, team_id]):
    return None

In Socket Mode, the team field is NOT in the inner event dict — it's in the outer body envelope. So team_id is always "" and every message is silently dropped.

Fix

In packages/slack/src/lintel/slack/socket_listener.py, the _register_handlers method needs to inject team from the bolt body into the event dict before passing it to _on_message:

@bolt_app.event("message")
async def handle_message(body: dict[str, Any], event: dict[str, Any], say: Any) -> None:
    if "team" not in event and "team_id" in body:
        event["team"] = body["team_id"]
    await self._on_message(event)

Files to change

  • packages/slack/src/lintel/slack/socket_listener.py — inject team_id from body into event in _register_handlers

Testing

  • Run make test-slack after the fix
  • Add a test that verifies handle_message injects team from body when missing from event
  • Verify end-to-end: send a Slack message and confirm it appears in Chats with a reply

Raised by Lintel 🤖

@bamdadd
bamdadd force-pushed the lintel/fix/d9b649c5-bug-slack-bot-receives-socket-mode-event branch 2 times, most recently from 4a89031 to 2d9799a Compare April 7, 2026 17:42
@bamdadd
bamdadd force-pushed the lintel/fix/d9b649c5-bug-slack-bot-receives-socket-mode-event branch from 2d9799a to 5fa7768 Compare April 7, 2026 17:46
@bamdadd

bamdadd commented Apr 7, 2026

Copy link
Copy Markdown
Owner Author

Closing stub PR from failed pipeline. Will retry with ingest fix.

@bamdadd bamdadd closed this Apr 7, 2026
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.

1 participant