Skip to content

feat: add Flue spam and off-topic filter agent#30832

Merged
mvvmm merged 26 commits into
productionfrom
flue-init
May 19, 2026
Merged

feat: add Flue spam and off-topic filter agent#30832
mvvmm merged 26 commits into
productionfrom
flue-init

Conversation

@mvvmm
Copy link
Copy Markdown
Contributor

@mvvmm mvvmm commented May 14, 2026

Summary

Adds a Flue-based spam and off-topic filter agent that automatically evaluates GitHub issues and pull requests against the cloudflare/cloudflare-docs repository and closes obvious spam or off-topic submissions.

How it works:

  • A GitHub webhook delivers events to the Orchestrate agent, which handles:
    • issues.opened and issues.reopened
    • pull_request.opened, pull_request.reopened, and pull_request.ready_for_review
  • The Orchestrate agent verifies the webhook signature and dispatches to the SpamAndOffTopicFilter agent with { eventType, number }.
  • The SpamAndOffTopicFilter agent fetches the canonical issue/PR metadata from the GitHub API (title, body, author, labels) and — for PRs — also fetches the file diff (capped at 25 files, 2,000 chars per patch).
  • A skill (spam-and-off-topic-filter/SKILL.md) instructs the model to evaluate the content and return a structured verdict: { is_spam, confidence, reason }.
  • Trusted code (not the model) applies a spam or off topic label, posts a comment, and closes the issue/PR when is_spam: true, confidence is medium or high, and the item is still open.
  • All GitHub content is treated as untrusted data to mitigate prompt injection.

Structure:

Path Description
.flue/agents/orchestrate.ts Webhook receiver; verifies signature and routes to the spam-and-off-topic filter
.flue/agents/spam-and-off-topic-filter.ts Fetches GitHub context, runs skill, acts on verdict
.flue/lib/github.ts GitHub API helpers (get issue, get PR, get PR files, post comment, add labels, close issue)
.flue/.agents/skills/spam-and-off-topic-filter/SKILL.md Model instructions for spam/off-topic classification
.flue/roles/cloudflare-docs-bot.md Role definition for the agent
.flue/wrangler.jsonc Wrangler config for the Cloudflare Worker

Tested against the latest 20 open PRs and 20 open issues — all legitimate PRs returned is_spam: false, and the three off-topic/support issues that would have been closed were correctly identified.

Screenshots (optional)

Spam PR

Screenshot 2026-05-14 at 6 43 55 PM

Closed by flue agent

Screenshot 2026-05-14 at 6 44 03 PM

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
* @cloudflare/product-owners
*.ts @cloudflare/content-engineering, @kodster28
*.js @cloudflare/content-engineering, @kodster28
package.json @cloudflare/content-engineering

@ask-bonk ask-bonk Bot added engineering Problems or updates to developers.cloudflare.com website triage Waiting for a docs team review. labels May 14, 2026
Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues need attention before merge. 4 inline comments posted.

Comment thread package.json Outdated
Comment thread package.json
Comment thread .flue/agents/spam-and-off-topic-filter.ts
Comment thread .flue/agents/orchestrate.ts Outdated
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 14, 2026

I reviewed PR #30832 and posted a review with inline comments.

Labels applied: engineering, triage

Summary of changes:
This PR adds a Flue-based spam-filter Worker (.flue/) that receives GitHub webhooks for new issues/PRs, uses an LLM skill to classify spam/off-topic content, and automatically closes obvious spam with a comment. It also adds the required npm packages, Flue build/deploy scripts, and R2 seeding logic.

Issues flagged (4 inline comments):

  • HIGH package.json:70@octokit/rest is added but never imported by the new Flue code. It bloats pnpm-lock.yaml (+13k lines) unnecessarily.
  • MEDIUM package.json:116just-bash is added as a direct dependency but never imported. @flue/sdk already depends on it transitively.
  • MEDIUM .flue/agents/spam-filter.ts:101 — Before closing an issue/PR, the agent should verify item.state === "open". Redelivered webhooks could otherwise post duplicate comments.
  • MEDIUM .flue/agents/orchestrate.ts:23 — Webhook signature verification is skipped when GITHUB_WEBHOOK_SECRET is absent. Failing closed prevents accepting forged webhooks if the environment is misconfigured.

Review posted at: #30832 (review)

github run

@mvvmm mvvmm changed the title feat: add Flue spam-filter agent for GitHub issues and PRs feat: add Flue spam and off-topic filter agent May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

@kodster28 kodster28 marked this pull request as ready for review May 15, 2026 14:23
@kodster28 kodster28 requested review from a team and kodster28 as code owners May 15, 2026 14:23
@mvvmm mvvmm requested a review from a team as a code owner May 18, 2026 20:39
@mvvmm
Copy link
Copy Markdown
Contributor Author

mvvmm commented May 19, 2026

/bonk please review

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 unused dependencies found. The other issues from the previous review were addressed.

Comment thread package.json
Comment thread package.json
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 19, 2026

Posted a review on PR #30832 with inline suggestions.

Findings:

  • package.json:85agents is added as a direct dependency but never imported anywhere in the repository.
  • package.json:115just-bash was flagged in the previous review and remains unused here too.

Both can be removed to reduce lockfile bloat. The other issues from the prior review (missing item.state guard, webhook secret fail-closed, and @octokit/rest bloat) were already addressed in the current branch.

github run

@mvvmm mvvmm merged commit 71b09d2 into production May 19, 2026
11 checks passed
@mvvmm mvvmm deleted the flue-init branch May 19, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engineering Problems or updates to developers.cloudflare.com website size/xl triage Waiting for a docs team review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants