← Back to PRs

#18408: fix(message): support react current alias and suppress leaked react errors

by sggolakiya open 2026-02-16 17:51 View on GitHub →
agents size: S
Fixes #18154 ## Problem Two issues with `message react`: 1. React errors (e.g. invalid emoji, missing permissions) leak as visible Discord messages instead of being handled silently 2. No shortcut to react to the current/triggering message — users must manually pass message IDs ## Changes - **message-action-params.ts**: Added `readCurrentMessageIdAlias()` — resolves `messageId: "current"` to the triggering message's ID from tool context - **message-action-runner.ts**: Maps `messageId=current` before dispatching to channel plugin - **payloads.ts**: Added `isSuppressedSideEffectToolError()` — suppresses react failures from user-visible output (still logged internally) - **Tests**: Added unit tests for both current-alias resolution and error suppression ## Tests All 27 unit tests pass. <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR fixes two issues with the `message react` action: (1) adds a `"current"` alias for `messageId` that resolves to the triggering message's ID from tool context, and (2) suppresses react failure errors from user-visible output while still logging them internally. - **`readCurrentMessageIdAlias`** in `message-action-params.ts` cleanly resolves `messageId: "current"` to the actual message ID from `currentThreadTs` in the tool context - **`isSuppressedSideEffectToolError`** in `payloads.ts` prevents react errors (invalid emoji, missing permissions, etc.) from appearing as visible Discord messages to the user - **Integration** in `message-action-runner.ts` hooks the alias resolution into the react action path, placed correctly after `applyTargetToParams` - **Tests** cover the alias resolution and error suppression paths - **Issue**: When `currentThreadTs` is not available (e.g., channels without `buildToolContext` or outside thread context), the `"current"` alias silently falls through as a literal string, which will fail at the API level and then be suppressed by the new error suppression — resulting in completely silent no-op behavior with no user feedback <h3>Confidence Score: 3/5</h3> - PR is mostly safe but has a silent failure mode when the "current" alias cannot be resolved - The core logic is sound and well-tested for the happy path. The main concern is an edge case where the "current" alias cannot be resolved (when currentThreadTs is unavailable), resulting in a literal "current" string being passed to the channel API. Combined with the new error suppression, this creates a completely silent failure with no user feedback. The score reflects this unhandled edge case in an otherwise clean PR. - Pay close attention to `src/infra/outbound/message-action-runner.ts` — the alias resolution fallback path when `currentThreadTs` is unavailable needs handling. <sub>Last reviewed commit: 8f74619</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs