Repository navigation
feat(comment-automation): add image-only filter and AI comment moderation - #1632
Merged
Merged
Conversation
…tion - "Only comments with an image" reply filter (Facebook, Instagram, Threads), recorded as the `noImageAttachment` miss reason - AI moderation: classify each comment on a matching post with a chosen AI agent's models, then hide or delete it; checked before the reply filters and a moderated comment is never answered - CommentModerationLog table, moderatedCount counter, moderation log card and public API (listModerationLogs, getModerationSummary) - Hide rules keep their original place and behavior (after the reply filters, hide and still answer), so existing "DM then hide" automations are unchanged - Re-enqueue a moderation still pending in the log, dedup hide/delete jobs by id, and settle every failure path so no log row stays pending - Missed-comment replays get their own AI/resume job ids and keep the replay's low priority Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ment moderation Co-Authored-By: Claude Opus 5.5 <[email protected]>
hello-jackytruong
referenced
this pull request
in hello-jackytruong/ChatWorkAI
Nov 22, 2026
…tion (#1632) * feat(comment-automation): add image-only filter and AI comment moderation - "Only comments with an image" reply filter (Facebook, Instagram, Threads), recorded as the `noImageAttachment` miss reason - AI moderation: classify each comment on a matching post with a chosen AI agent's models, then hide or delete it; checked before the reply filters and a moderated comment is never answered - CommentModerationLog table, moderatedCount counter, moderation log card and public API (listModerationLogs, getModerationSummary) - Hide rules keep their original place and behavior (after the reply filters, hide and still answer), so existing "DM then hide" automations are unchanged - Re-enqueue a moderation still pending in the log, dedup hide/delete jobs by id, and settle every failure path so no log row stays pending - Missed-comment replays get their own AI/resume job ids and keep the replay's low priority Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(worker): pass job context to orphaned-integration cleanup for comment moderation Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Deathgiver <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
options.onlyCommentsWithImageswitch (Facebook and Threads; ignored with a capability log elsewhere). A skipped comment records the newnoImageAttachmentmiss reason.hideComments.aiModeration(aiAgentId,categories,instruction,action: hide | delete). Each comment on a matching post goes to anAIJobAction.commentModerationjob that classifies it with the agent's models (comment passed as quoted data, never as instructions). A flagged comment is hidden or deleted and is not answered. If a provider fails, the comment goes back through the reply flow unmoderated (fail open).CommentModerationLogtable (one row per automation + comment, statuspending/done/failed), amoderatedCountcounter, a "Moderated comments" card, and public APIcommentAutomations.listModerationLogs/getModerationSummary(CLI/MCP docs updated).Behavior kept for existing automations
Hide rules (
all, phone number, link, keywords, image/video/GIF/emoji) stay where they were: they run only for comments that pass the reply filters, and the comment is hidden and still answered. Existing "DM then hide" automations behave the same. Only AI moderation runs before the reply filters and blocks the reply.Reliability fixes from review
pending(enqueue failed) gets its hide/delete enqueued again. Hide/delete jobs use a fixed jobId (moderate-comment-<automation>-<comment>), so a still-queued job does not run twice.replay: true. The AI job and the resumed job get their own jobIds and keep the replay's low priority. The resumed job uses default retries.failedfor every failure path (missing or non-comment message, integration lookup error), so no row stayspending.Migrations
20261102072403_add_comment_automation_miss_no_image— adds thenoImageAttachmentmiss reason20261102080247_comment_moderation_log— new table and counterdb:check-driftis clean. Migrations have not been applied anywhere.Test plan
pnpm lintcomment-automation,comment-moderation,comment-automation-attachment(245 tests)🤖 Generated with Claude Code