Skip to content

fix: use reactions.list API and post kickoff message for reaction triggers - #88

Merged
IceRhymers merged 2 commits into
masterfrom
fix/reactions
Mar 31, 2026
Merged

fix: use reactions.list API and post kickoff message for reaction triggers#88
IceRhymers merged 2 commits into
masterfrom
fix/reactions

Conversation

@IceRhymers

Copy link
Copy Markdown
Owner

What broke and why

The original implementation (#86) used conversations.history with _last_seen_ts to scan for reactions. This was fundamentally wrong:

  • _last_seen_ts is a forward-moving watermark — it only fetches messages newer than the last poll
  • Reactions are added to existing messages, which are already older than _last_seen_ts
  • So Phase 3 would always return an empty message list and never trigger

The second bug: the session was keyed on the original message ts in the original channel, not in the self-DM. This broke the assumption that all sessions live in self._channel_id (the self-DM).

Fix

  • Replace conversations.history with reactions.list — the correct API for "what messages has this user recently reacted to"
  • Post a kickoff message in the self-DM channel and use its ts as the thread root, matching the existing @mention-triggered session flow
  • Session dedup uses the original msg_ts as an anchor (stored in a dummy session) to prevent re-triggering on re-polls

Root cause in our design process

We modeled reaction detection as "messages polling" (Phase 3 reusing the history-scan pattern) when it should have been modeled as "event polling" using the dedicated Slack reactions API.

Fixes #85

…ggers

The reaction trigger feature was broken because _check_reaction_triggers
used conversations.history with a forward-moving cursor (_last_seen_ts),
which never returned messages that already existed when a reaction was
added. Replaced with Slack's reactions.list API which queries by reaction
recency, not message age. Also fixed thread creation to post a kickoff
message in the self-DM and use its ts as the thread root, matching the
existing @mention-triggered session flow.
Enhanced the instructions for the end-to-end deployment process by specifying that it takes around 5-10 minutes to start when the app compute is off, ensuring users have a clearer expectation of the deployment duration.
@IceRhymers
IceRhymers merged commit 283ea2e into master Mar 31, 2026
1 check passed
@IceRhymers
IceRhymers deleted the fix/reactions branch April 3, 2026 14:37
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.

feat: spawn thread via emoji reaction trigger

2 participants