adk-samples icon indicating copy to clipboard operation
adk-samples copied to clipboard

feat(go/github-bots): add spam-detection bot + reusable workflow

Open karolpiotrowicz opened this issue 5 months ago • 0 comments

Summary

Adds spam-detection, a self-contained GitHub-bot ADK Go sample under go/github-bots/. It moderates a repository's open issues for spam (SEO/link spam, third-party promotion, off-topic solicitation): it applies a spam label and posts one comment alerting maintainers.

  • Code-orchestrated: code selects candidate issues and runs the LLMAgent once per issue in its own errgroup-bounded, issue-scoped session (withAuditedIssue).
  • Deterministic work in code, judgment in the model: the bot filters maintainers/bots/already-handled content and truncates in spam.go, then embeds the finished, untrusted-marked text in the per-issue prompt. The model's only tool is flag_issue_as_spam; if nothing reviewable remains, the model is never invoked (zero-waste).
  • Ships a reusable workflow (.github/workflows/go-spam-detection.yml) so a target repo runs the bot via a thin caller.

Hardening (same-model + cross-model adversarial review)

  • Per-issue session scope plus a per-issue random nonce fence so untrusted issue/comment text can neither redirect the tool to another issue nor break out of the prompt.
  • Self-identity match is exact (no [bot]-suffix trust), so a GitHub App can't spoof the alert signature to suppress moderation.
  • Comment-before-label ordering so a failed write never drops the maintainer alert; within-run + label-based idempotency prevents duplicates.
  • Fail-loud for CI; dry-run chokepoint; temperature 0; case-insensitive maintainer/identity matching.

Deliberate divergences from the Python adk_issue_monitoring_agent are documented in doc.go/README (capped event-triggered sweep, title review, code blocks kept, plain-text alert, datetime freshness window).

Verification

go build, go vet, gofmt, go test -race (67 tests, all pass), golangci-lint (0 findings); actionlint clean on the workflow. The spam label already exists on google/adk-go.

Draft. Self-contained — this PR adds only the spam-detection module and its reusable workflow (no dependency on other bots). The go/github-bots/README.md index row can be added once the bot directory layout lands on main.

karolpiotrowicz avatar Jun 12 '26 18:06 karolpiotrowicz