Skip to content

feat: emoji reaction as immediate feedback for @bot in threads - #145

Merged
lishuceo merged 2 commits into
mainfrom
feat/claude-session-c7aafd
Mar 12, 2026
Merged

feat: emoji reaction as immediate feedback for @bot in threads#145
lishuceo merged 2 commits into
mainfrom
feat/claude-session-c7aafd

Conversation

@lishuceo

Copy link
Copy Markdown
Owner

Summary

  • When a user @bot in a thread (where quick-ack is skipped), the bot now adds an "OnIt" emoji reaction to the user's message as immediate visual feedback
  • The reaction is automatically removed in the finally block after the formal reply is sent (or on error)
  • Added addReaction() and removeReaction() methods to FeishuClient wrapping the Feishu im.messageReaction API

Test plan

  • New test file src/__tests__/thread-reaction.test.ts with 7 test cases covering:
    • Reaction added only when eventThreadId is present
    • Reaction not added in main chat (no thread)
    • Reaction removed after successful reply
    • Reaction removed even on execution error (finally block)
    • Graceful handling when addReaction fails or throws
    • Removal failure is fire-and-forget (doesn't throw)
  • TypeScript type check passes
  • All 1024 existing tests pass (1 pre-existing flaky test in memory/quality unrelated)

🤖 Generated with Claude Code

lishuceo and others added 2 commits March 12, 2026 12:46
When a user @bot in a thread, quick-ack is skipped, leaving no immediate
visual feedback. Now the bot adds an "OnIt" emoji reaction to the message
as soon as it's received, then removes it in the finally block after the
formal reply is sent (or on error).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests for the emoji reaction feature: add reaction in thread, remove
after reply, cleanup on error, graceful handling of API failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Mar 12, 2026

Copy link
Copy Markdown

Claude finished @lishuceo's task in 58s —— View job


PR Review: Emoji Reaction as Immediate Feedback

  • Check for previous review comments — none found
  • Read changed files and understand context
  • Trace cross-module interactions
  • Post review findings

Review Summary

Approved — Clean, well-structured change that follows existing codebase patterns.

Analysis

src/feishu/client.tsaddReaction() and removeReaction() (lines 652-693)

  • Follow the same try/catch + logging pattern used by all other methods in this class
  • Correctly use logger.warn (not error) since reaction failures are non-critical
  • Return types are appropriate (string | undefined for add, boolean for remove)
  • No issues found

src/feishu/event-handler.ts — Integration in executeDirectTask

  • Reaction is added before the try block with .catch(() => undefined) — correct, this ensures pendingReactionId is undefined on failure rather than throwing
  • Cleanup in finally block with .catch(() => {}) (fire-and-forget) — correct for non-critical cleanup
  • The if (eventThreadId) guard properly scopes this to thread-only messages
  • The removeReaction is intentionally not awaited in finally, making cleanup non-blocking — this is fine since it's best-effort

src/__tests__/thread-reaction.test.ts — 7 test cases

  • Tests simulate the reaction flow logic rather than invoking executeDirectTask directly — pragmatic given the function's complexity and dependencies
  • Covers the key scenarios: add/remove lifecycle, error paths, graceful failure handling
  • @ts-nocheck is acceptable for test files with heavy mocking

Overall Assessment

The feature is minimal, well-scoped, and follows established patterns. The addReaction/removeReaction APIs match the existing client method conventions. The try/finally cleanup pattern ensures reactions don't linger on error. No bugs, security concerns, or architectural issues found.

@lishuceo
lishuceo merged commit 5fd5146 into main Mar 12, 2026
6 of 7 checks passed
@lishuceo
lishuceo deleted the feat/claude-session-c7aafd branch March 12, 2026 05:18
lishuceo added a commit that referenced this pull request Apr 8, 2026
* feat: add emoji reaction as immediate feedback for @bot in threads

When a user @bot in a thread, quick-ack is skipped, leaving no immediate
visual feedback. Now the bot adds an "OnIt" emoji reaction to the message
as soon as it's received, then removes it in the finally block after the
formal reply is sent (or on error).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add thread reaction tests

Tests for the emoji reaction feature: add reaction in thread, remove
after reply, cleanup on error, graceful handling of API failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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