Skip to content

fix(send_message): resolve Slack user IDs to DM channel IDs (#27936)#28349

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3ad7d98a
May 19, 2026
Merged

fix(send_message): resolve Slack user IDs to DM channel IDs (#27936)#28349
teknium1 merged 1 commit into
mainfrom
hermes/hermes-3ad7d98a

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Salvage of #27936 by @jvinals.

What: _SLACK_TARGET_RE accepted only C/G/D-prefixed Slack IDs (channels, groups, DMs). When the agent had a Slack user ID (U-prefixed, e.g. from message metadata), send_message fell through to channel-name resolution and failed — Slack's chat.postMessage requires a conversation ID, not a user ID.

How:

  • Add U to the regex so user IDs are recognized as Slack targets.
  • For U-prefixed targets, call conversations.open to fetch the DM channel ID (D...) and swap chat_id to that before posting.
  • Surface a clear error if im:write scope is missing.

Original PR: #27936

The _SLACK_TARGET_RE regex only matched IDs starting with C (channel),
G (group), or D (direct message). Slack user IDs start with U, causing
'Could not resolve' errors when trying to send DMs to specific users.

Changes:
- Expand _SLACK_TARGET_RE to accept U-prefixed IDs (user IDs)
- Add conversations.open fallback to resolve user IDs to DM channel
  IDs before sending, since chat.postMessage requires a conversation ID

Fixes #ISSUE_NUMBER
@teknium1 teknium1 merged commit 09b6dcc into main May 19, 2026
@teknium1 teknium1 deleted the hermes/hermes-3ad7d98a branch May 19, 2026 03:07
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-3ad7d98a vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8791 on HEAD, 8790 on base (🆕 +1)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4626 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

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