Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/fix-industry-alerts-channel-filter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"adcontextprotocol": patch
---

Fix industry alerts not posting to Slack channels

The `hasAlertedPerspective()` check was blocking articles from being posted to real Slack channels if they had already been posted to website-only channels. Removed the redundant check since the SQL query already handles per-channel deduplication correctly.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions server/src/addie/services/industry-alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import { logger } from '../../logger.js';
import { sendChannelMessage } from '../../slack/client.js';
import type { SlackBlock } from '../../slack/types.js';
import { query } from '../../db/client.js';
import {
recordPerspectiveAlert,
hasAlertedPerspective,
} from '../../db/industry-feeds-db.js';
import { recordPerspectiveAlert } from '../../db/industry-feeds-db.js';
import {
getActiveChannels,
isWebsiteOnlyChannel,
Expand Down Expand Up @@ -298,11 +295,6 @@ export async function processAlerts(): Promise<{
continue;
}

// Skip if already alerted (race condition protection)
if (await hasAlertedPerspective(article.perspective_id)) {
continue;
}

// Verify pacing: quality 5 always posts, quality 4 only if quiet
if (article.quality_score === 4 && !isQuiet) {
logger.debug(
Expand Down
61 changes: 0 additions & 61 deletions server/src/db/industry-feeds-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,17 +380,6 @@ export async function getRecentRssPerspectives(

// ============== Alert Operations ==============

/**
* Check if we've already alerted for this perspective
*/
export async function hasAlertedPerspective(perspectiveId: string): Promise<boolean> {
const result = await query<{ exists: boolean }>(
`SELECT EXISTS(SELECT 1 FROM industry_alerts WHERE perspective_id = $1)`,
[perspectiveId]
);
return result.rows[0].exists;
}

/**
* Record that we sent an alert for a perspective
*/
Expand All @@ -409,56 +398,6 @@ export async function recordPerspectiveAlert(
return result.rows[0];
}

/**
* Get RSS perspectives that should be alerted
* (high quality, relevant mentions, not yet alerted)
*/
export async function getPerspectivesToAlert(): Promise<{
id: string;
title: string;
link: string;
summary: string;
addie_notes: string;
quality_score: number;
mentions_agentic: boolean;
mentions_adcp: boolean;
relevance_tags: string[];
feed_name: string;
}[]> {
const result = await query<{
id: string;
title: string;
link: string;
summary: string;
addie_notes: string;
quality_score: number;
mentions_agentic: boolean;
mentions_adcp: boolean;
relevance_tags: string[];
feed_name: string;
}>(
`SELECT p.id, p.title, p.external_url as link,
k.summary, k.addie_notes, k.quality_score,
k.mentions_agentic, k.mentions_adcp, k.relevance_tags,
f.name as feed_name
FROM perspectives p
JOIN industry_feeds f ON p.feed_id = f.id
JOIN addie_knowledge k ON k.source_url = p.external_url
WHERE p.source_type = 'rss'
AND p.status = 'published'
AND k.fetch_status = 'success'
AND NOT EXISTS (SELECT 1 FROM industry_alerts ia WHERE ia.perspective_id = p.id)
AND (k.quality_score >= 4 OR k.mentions_agentic = true OR k.mentions_adcp = true)
ORDER BY
CASE WHEN k.mentions_adcp THEN 0
WHEN k.mentions_agentic THEN 1
ELSE 2 END,
k.quality_score DESC NULLS LAST
LIMIT 20`
);
return result.rows;
}

// ============== Stats ==============

export interface FeedStats {
Expand Down