Skip to content

fix: resolve Slack user mentions and display leader names correctly#654

Merged
bokelley merged 1 commit into
mainfrom
bokelley/fix-user-ids-display
Jan 6, 2026
Merged

fix: resolve Slack user mentions and display leader names correctly#654
bokelley merged 1 commit into
mainfrom
bokelley/fix-user-ids-display

Conversation

@bokelley

@bokelley bokelley commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix display of committee leaders that were added using Slack user IDs
  • Resolve Slack user mentions in messages to include names for better LLM understanding
  • Auto-resolve Slack IDs to WorkOS IDs when adding/removing leaders

Changes

  1. SQL query fix (working-group-db.ts): Added LEFT JOIN to slack_user_mappings in getLeaders() and getLeadersBatch() so leaders stored with Slack IDs can have their names displayed correctly

  2. Mention resolution (security.ts, handler.ts): Added resolveSlackMentions() function that converts <@U123> to <@U123|Name> before sending to Claude, preventing user confusion in the LLM

  3. Admin tools fix (admin-tools.ts): add_committee_leader and remove_committee_leader now auto-detect Slack user IDs and resolve them to WorkOS IDs when possible

Test plan

  • All tests pass (179 tests)
  • TypeScript compiles without errors
  • Code review addressed critical issues ($ escaping, robust regex pattern)

🤖 Generated with Claude Code

This PR addresses an issue where committee leaders were showing as Slack
user IDs (like U0A1RAMRWNS) instead of their names.

Changes:
- Add LEFT JOIN to slack_user_mappings in getLeaders/getLeadersBatch to
  look up names for leaders stored with Slack user IDs
- Add resolveSlackMentions() to convert <@u123> to <@u123|Name> before
  sending to LLM, so Claude/Addie can correctly identify mentioned users
- Update add/remove_committee_leader handlers to auto-resolve Slack IDs
  to WorkOS IDs when possible
- Use more robust Slack ID pattern matching (/^U[A-Z0-9]{8,}$/)
- Escape $ characters in names during replacement to prevent issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit bec5868 into main Jan 6, 2026
6 checks passed
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