Skip to content

Commit 5d07b84

Browse files
committed
feat(triage): override ignore classification when bot is @mentioned
Added logic to ensure that if the bot is mentioned in a message, it overrides the 'ignore' classification and triggers a response. This enhancement improves the bot's responsiveness in conversations where it is directly addressed.
1 parent c675572 commit 5d07b84

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/modules/triage.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,20 @@ async function runClassification(channelId, snapshot, evalConfig, evalClient) {
121121
totalCostUsd: classifyMessage.total_cost_usd,
122122
});
123123

124+
// Never ignore when the bot is @mentioned — override classifier mistakes.
125+
const botId = evalClient.user?.id;
126+
if (classification.classification === 'ignore' && botId) {
127+
const mentionTag = `<@${botId}>`;
128+
const mentioned = snapshot.some((m) => m.content?.includes(mentionTag));
129+
if (mentioned) {
130+
info('Triage: overriding ignore → respond (bot was @mentioned)', { channelId });
131+
classification.classification = 'respond';
132+
classification.targetMessageIds = snapshot
133+
.filter((m) => m.content?.includes(mentionTag))
134+
.map((m) => m.messageId);
135+
}
136+
}
137+
124138
if (classification.classification === 'ignore') {
125139
info('Triage: ignoring channel', { channelId, reasoning: classification.reasoning });
126140
return null;

0 commit comments

Comments
 (0)