Skip to content

Add per-thread Slack DM sessions#18

Open
HaiyiMei wants to merge 1 commit into
longbkit:mainfrom
HaiyiMei:agent/slack-dm-thread-sessions
Open

Add per-thread Slack DM sessions#18
HaiyiMei wants to merge 1 commit into
longbkit:mainfrom
HaiyiMei:agent/slack-dm-thread-sessions

Conversation

@HaiyiMei

Copy link
Copy Markdown

Summary

  • add an opt-in Slack bot setting, dmSessionScope: peer | thread, with backward-compatible peer behavior by default
  • route Slack DMs in thread mode to a session key derived from the DM peer and root thread timestamp
  • add bots get-dm-session-scope and bots set-dm-session-scope commands for safe configuration changes
  • document behavior, rollback, and the fact that changing scope does not delete existing sessions

User impact

Operators can isolate separate Slack DM threads into separate agent/Codex sessions while preserving context inside each thread:

clisbot bots set-dm-session-scope --channel slack --bot default --scope thread

A DM without a resolvable thread ID safely falls back to the existing peer session. Setting the scope back to peer restores the current one-session-per-peer behavior.

Implementation

When dmSessionScope resolves to thread, Slack DM routing appends the resolved root thread_ts to the existing peer session key and exposes the peer session as its parent. Other Slack surfaces and other channels are unchanged.

This PR is separate from, but operationally complements, #17. Message-tool mode should include #17 so Slack DM final markers use the same user-keyed target as inbound sessions.

Validation

  • focused tests: 40 pass, 0 fail
  • bun run typecheck — pass
  • bun run build — pass
  • git diff --check — pass
  • bun run check — 992 pass, 1 unrelated failure in zalo-personal zca-js wrapper > refreshes the stored session after session login succeeds; this is the existing full-suite isolation failure also reproduced on clean upstream main, and the failing file passes in isolation (3 pass, 0 fail)

@HaiyiMei
HaiyiMei marked this pull request as ready for review July 15, 2026 13:39
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