Skip to content

fix(repair): admit spam scan comments by facts, pass keyword hits as model input - #1777

Merged
obviyus merged 1 commit into
mainfrom
judges-d2a-spam-admission
Oct 9, 2026
Merged

obviyus merged 1 commit into
mainfrom
judges-d2a-spam-admission

Conversation

@obviyus

@obviyus obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

Spam scan admission now uses facts only. Keyword patterns no longer decide which comments the model sees.

  • src/repair/spam-scanner-core.ts shouldSendToCheapModel admits a comment when its author is not protected and either its body has at least 12 characters, or it has a link or a GitHub minimization.
  • Keyword patterns no longer gate admission. These are SOLICITATION_PATTERNS, the priced pitch, the URL shortener, the external-link counts, and the technical-context keywords. They still run, and the model gets their results as labelled input in deterministic_facts and technical_context_facts. The policy text tells the model these are inputs, not verdicts. outside_author_with_external_link is now recorded as a plain fact. It no longer depends on another keyword hit.
  • The broad scan puts admitted comments first in its priority order.
  • Event intake (spam-comment-intake.ts) uses the same admission rule. It keeps a forwarded minimized_reason. Its reason text lists the facts.
  • Docs: docs/spam-scanner.md, docs/target-dispatcher.md. Changelog: changelog.d/spam-admission-facts-only.md.

Batch D, part 2a. Part 1 is #1775. Parts 2b and 2c follow separately.

Why

Maintainer rule (LLM systems): code must not judge with keyword matching. Code selects by facts, and the model judges. In the code-judge inventory (Batch D), the spam-scanner-core keyword admission gate decided which comments the model ever saw. A comment with no listed keyword never reached the model. The maintainer approved this option: admit by facts, and pass keyword hits to the model as labelled input.

Proof (real data)

I fetched 24,818 real openclaw/openclaw comments from 2026-10-01T22:26Z to 2026-10-08: 24,789 from gh api repos/openclaw/openclaw/issues/comments?since=… and 29 from …/pulls/comments?since=…. I ran them through shouldSendToCheapModel from a main build and from this branch, with the scanner's default trusted bots. spam-scanner-core is unchanged on main.

main this PR
admitted to the model (7 days) 1 1,222
per day 0.1 ≈175
  • 23,586 comments are from protected authors or bots. Neither build admits them.
  • All 1,222 admitted comments are from NONE-association authors, 581 distinct.
  • 169 admitted comments have a link. 37 have any keyword fact.
  • The average admitted body is ≈1.1k characters.

Tests:

  • Admission ignores keywords: keyword-free outside comments are admitted.
  • A short comment needs a link or a minimization. This is tested in core and through event intake.
  • Facts reach the model input.
  • Protected authors stay excluded.

pnpm run check (on ef343c0, before the rebase onto e4c173a): exit 0. That covers static, format, build, lint and all tests (6,947 passed, 0 failed). The rebase brought in #1774 only (close-path files). After the rebase, both spam test files pass.

Needs maintainer call

None. The maintainer chose facts-only admission.

Codex review dispositions

  • Round 1 (combined pre-model branch): [P2] Event intake dropped minimized_reason, so the minimization exception never fired on the webhook path. Fixed: intake keeps a forwarded minimized_reason, and a test covers it. GitHub webhooks do not carry minimization, so the hourly scan stays the main path for that fact, because it hydrates minimization through GraphQL.
  • Round 2 (this split branch): no actionable findings.

Merge Danger

  • Door: two-way. No stored data or marker formats change. The audit record keeps its deterministic block. Revert restores keyword admission.
  • Blast radius: spam scanning only. That is the hourly spam-scanner.yml and the event path through github-activity → clawsweeper_spam_comment. The lane stays audit-only (action: none). It never blocks users, hides comments, or labels anything.
  • Approved decision (maintainer): admit by facts only, and pass keyword hits to the model as labelled input.
  • Spend change: on the last 7 days of real comments, model admission goes from 1 to 1,222 comments a week (≈175 a day).
    • Each admission on the event path dispatches one extra spam-scanner.yml Actions run and one internal model call (medium reasoning, one comment). That is ≈175 extra Actions runs and ≈175 small model calls a day.
    • Each call carries the system prompt, the policy, one comment (≈1.1k characters, capped at 1,600) and its facts. I estimate ≈0.6–0.8k input tokens per call before reasoning, so roughly 105–140k input tokens a day plus reasoning and output tokens [INFERENCE: token counts estimated from character counts, not measured].
    • The hourly catch-up batches up to 100 comments per call. It skips comment versions that the ledger has already processed, so it adds little on top of the event path.
    • Comments from protected authors and bots (≈95% of volume) still cost nothing.

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The branch admits unprotected GitHub comments to spam scanning using length, links and minimization, while passing keyword matches to the model as context.

Example: An outside author comments “Still hangs for me on the latest release.”

  • Before: The comment has no qualifying spam keyword and does not reach the model.
  • After: The comment qualifies by length and reaches the model for audit-only classification.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and useful, while the supplied real-data evidence establishes helper behavior rather than the shipped runtime path.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Maintenance · Worth it: Yes
User problem: Comments without recognized spam wording never reach the model, leaving gaps in the spam audit.
Reason: This implements the recorded maintainer direction that code admits by facts and the model judges spam. The change stays within the existing audit scanner and documents its increased workload.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary on current main, and neither related PR owns the spam-admission change. No actionable patch defect was found.

Priority: P2
Reviewed head: c85b9504fa953a2d85e01c1065ea4b98da2bcd6a

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Show a keyword-free outside comment passing through shipped event intake and scanner/model execution to an audit-only result; the supplied helper replay does not establish that path.
Agent review details

How this fits together

ClawSweeper scans GitHub comments through event intake and an hourly catch-up scan. Admission selects comments for model classification, which produces audit records without hiding comments or blocking users.

flowchart TD
  A[GitHub comment events] --> C[Fact-based admission]
  B[Hourly comment scan] --> C
  C --> D[Protected or short comments skipped]
  C --> E[Model receives comment and context facts]
  E --> F[Spam classification]
  F --> G[Audit records without moderation actions]
Loading

Technical review

Best possible solution:

Keep one shared fact-based admission owner and let the model classify comments, preserving protected-author exclusions and audit-only output.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main rejects keyword-free outside comments such as “Still hangs for me on the latest release.” before model classification. This review did not execute target code.

Is this the best way to solve the issue?

Yes: changing the shared admission predicate addresses both event intake and broad scanning without adding a parallel classifier or configuration option.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e4c173aeed28.

Provenance checked

  • src/repair/spam-scanner-core.ts: keyword-based admission and external-link facts changes intended behavior with a stated reason (6674b1c: Prioritize real spam scan candidates by excluding external links alone from candidacy.)
  • src/repair/spam-scanner-core.ts: broad-scan prioritization keeps the original intent (1d70cc4: Avoid starving spam scan candidates by selecting unprocessed candidates before other comments.)
  • src/repair/spam-comment-intake.ts: event admission changes intended behavior with a stated reason (e2e261a: Dispatch live spam comment scans through the shared scanner admission predicate.)
  • src/repair/spam-scanner-core.ts: model context and deterministic audit output keeps the original intent (47040ef: Add an audit-only spam scanner.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Unique work remains on main: Current main still requires deterministicSpamSignals(comment).candidate for model admission. The live main revision matches the pinned base. The file lists of fix(close): close automation reads typed fields and exact labels, not prose judges #1774 and fix(repair): route repair, automerge and intake lanes on typed fields, not prose #1775 do not include either changed spam production file. (src/repair/spam-scanner-core.ts:151, e4c173aeed28)
  • Shared admission and protected authors: The shared predicate retains author protection and admits comments by trimmed length, URL presence or minimization. Both broad-scan prioritization and event intake use it. (src/repair/spam-scanner-core.ts:145, c85b9504fa95)
  • Recorded product decision and measured scope: The fully supplied PR body records the maintainer-approved facts-only admission direction and reports replaying 24,818 real comments through base and branch admission functions: admission increases from 1 to 1,222 comments over seven days. This establishes helper behavior and expected workload, rather than execution of the scanner workflow. Captured source identity: 32c5ba1bce068a0d6eebeadafa806d758f3d04e38503e70c87100ad3771209e1. (c85b9504fa95)
  • Audit-only final effect: The production scanner sends the changed model input through its existing Responses request and records action: none. The diff adds no moderation action, credential source, executable dependency or permission. (src/repair/spam-scanner.ts:76, c85b9504fa95)
  • Stored-state compatibility: Removing candidate from deterministicSpamSignals also removes deterministic.candidate from newly written audit JSON. Existing audit records are not loaded by scanner decision code, no checked-in consumer depends on that field, and ledger loading and comment-version identity remain unchanged; no existing-state migration is needed. OpenClaw Bay has no checked-in consumer of these spam audit fields. (src/repair/spam-scanner.ts:342, c85b9504fa95)
  • Original admission intent: History explicitly narrowed external-link candidacy to prioritize real spam-shaped candidates, then added processed-version-aware prioritization to avoid starvation. The PR explains its intentional replacement of keyword admission with model-owned judgment. Associated-PR REST lookups for these historical commits returned no entries. (src/repair/spam-scanner-core.ts:154, 6674b1c29d8a)

Likely related people:

  • Peter Steinberger: Raw commit 47040ef adds src/repair/spam-scanner-core.ts:82 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 47040efcb651; files: src/repair/spam-scanner-core.ts)

Review metrics

Metric Value Why it matters
Admission volume Reported real-data replay: 1 → 1,222 comments per week The broader admission policy materially increases event-triggered scanner and model workload.

Labels

Label changes:

  • add P2: This is a bounded spam-scanner improvement without evidence of an urgent user-facing outage.
  • add merge-risk: 🚨 automation: The recorded facts-only admission decision expands which comments trigger scanner workflows and model calls; the PR quantifies the resulting workload.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This is a bounded spam-scanner improvement without evidence of an urgent user-facing outage.
  • merge-risk: 🚨 automation: The recorded facts-only admission decision expands which comments trigger scanner workflows and model calls; the PR quantifies the resulting workload.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 8, 2026, 8:03 PM ET / October 9, 2026, 00:03 UTC.

@obviyus
obviyus merged commit 5a5fe25 into main Oct 9, 2026
23 checks passed
@obviyus
obviyus deleted the judges-d2a-spam-admission branch October 9, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant