Skip to content

refactor: thread slackUserId through Slack bot createSession#535

Merged
ColeMurray merged 1 commit intomainfrom
pre-step-5/slack-thread-userId
Apr 22, 2026
Merged

refactor: thread slackUserId through Slack bot createSession#535
ColeMurray merged 1 commit intomainfrom
pre-step-5/slack-thread-userId

Conversation

@ColeMurray
Copy link
Copy Markdown
Owner

@ColeMurray ColeMurray commented Apr 22, 2026

Summary

  • Adds slackUserId parameter to createSession in the Slack bot
  • Includes slack_user_id in structured log metadata for session creation
  • The Slack user ID was already available at the call site (startSessionAndSendPrompt) but was not passed through to createSession
  • No control plane changes — the value flows through logging only for now

Pre-step 5 of the unified user model migration (pre-steps doc). The main migration will add identity resolution (getUserInfo) and forward actor* fields through this same parameter path — having the user ID already threaded keeps that PR focused on identity logic.

Test plan

  • npm run typecheck -w @open-inspect/slack-bot passes
  • npm test -w @open-inspect/slack-bot — all 44 tests pass

Summary by CodeRabbit

  • Chores
    • Enhanced Slack bot session handling to better track user information during session creation.

Add slackUserId parameter to createSession and include it in
structured log metadata. The Slack user ID was already available
at the call site but not passed through. No control plane changes
yet — the value flows through logging only.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ccbd45e0-198f-4eee-898b-33209ec0e362

📥 Commits

Reviewing files that changed from the base of the PR and between 4d37590 and 3b61e72.

📒 Files selected for processing (1)
  • packages/slack-bot/src/index.ts

📝 Walkthrough

Walkthrough

Extended the createSession() function to accept an optional slackUserId parameter, which is passed through to the control-plane request payload as slack_user_id. Updated the caller to provide the userId when invoking the function.

Changes

Cohort / File(s) Summary
Slack Bot Session Enhancement
packages/slack-bot/src/index.ts
Added optional slackUserId?: string parameter to createSession() and included it in the control-plane request payload as slack_user_id. Updated startSessionAndSendPrompt() to pass userId as the new parameter when calling createSession().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • open-inspect

Poem

🐰 A user ID hops along,
Through slack's bot channels, bright and strong,
Sessions now remember who,
With slack\_user\_id shining through! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: threading slackUserId through the createSession function in the Slack bot codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pre-step-5/slack-thread-userId

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Terraform Validation Results

Step Status
Format
Init
Validate

Note: Terraform plan was skipped because secrets are not configured. This is expected for external contributors. See docs/GETTING_STARTED.md for setup instructions.

Pushed by: @ColeMurray, Action: pull_request

Copy link
Copy Markdown
Contributor

@open-inspect open-inspect Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

PR Title and number: refactor: thread slackUserId through Slack bot createSession (#535)
Author: @ColeMurray
Files changed count: 1, additions/deletions: +5/-2

This change cleanly threads the Slack user ID into createSession and limits the behavioral impact to structured logging, matching the PR description. I reviewed the touched path for correctness, logging implications, and call-site consistency, and did not find blocking issues.

Critical Issues

  • None.

Suggestions

  • [Testing] packages/slack-bot/src/index.ts:891 - Consider adding an explicit assertion in src/index.test.ts that the session-creation log metadata includes slack_user_id, since that is the only behavioral change in this PR. The existing suite exercises the path, but a direct assertion would better protect this migration step from regression.

Nitpicks

  • None.

Positive Feedback

  • The parameter is threaded through the narrowest possible surface area, which keeps this pre-migration step focused.
  • The control-plane request body is unchanged, avoiding accidental behavior changes outside logging.
  • The existing Slack bot typecheck and test suite still pass against this branch, which reduces regression risk.

Questions

  • None.

Verdict

  • Approve: Ready to merge, no blocking issues.

@ColeMurray ColeMurray merged commit 95707dd into main Apr 22, 2026
18 checks passed
@ColeMurray ColeMurray deleted the pre-step-5/slack-thread-userId branch April 22, 2026 06:30
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