-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(api-service,framework): agent onReaction event fixes NV-7370 #10733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -295,5 +295,20 @@ export class ChatSdkService implements OnModuleDestroy { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.logger.error(err, `[agent:${agentId}] Error handling action ${event.actionId}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| chat.onReaction(async (event: any) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.inboundHandler.handleReaction(agentId, config, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| emoji: event.emoji, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| added: event.added, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| messageId: event.messageId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: event.message, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| thread: event.thread, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user: event.user, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+299
to
+308
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skip malformed reaction events before forwarding. Unlike the action path on Line 284, this branch forwards Suggested guard chat.onReaction(async (event: any) => {
try {
+ if (!event.thread || !event.user) {
+ this.logger.warn(`[agent:${agentId}] Reaction received without complete context, skipping`);
+
+ return;
+ }
+
await this.inboundHandler.handleReaction(agentId, config, {
emoji: event.emoji,
added: event.added,
messageId: event.messageId,
message: event.message,As per coding guidelines, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.logger.error(err, `[agent:${agentId}] Error handling reaction`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a blank line before
returnin this block.This block violates the TS/JS style rule used in this repo.
Proposed fix
if (!conversation) { + return; }As per coding guidelines:
**/*.{ts,tsx,js,jsx}— “Include a blank line before everyreturnstatement”.📝 Committable suggestion
🤖 Prompt for AI Agents