Skip to content

feat(slop): AI-assisted advisory slop layer (advisory-only, never blocks) - #724

Merged
JSONbored merged 1 commit into
mainfrom
feat/ai-advisory-slop
Jun 14, 2026
Merged

feat(slop): AI-assisted advisory slop layer (advisory-only, never blocks)#724
JSONbored merged 1 commit into
mainfrom
feat/ai-advisory-slop

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

What

Completes the slop feature (#716) with the AI-assisted advisory layer — an opt-in AI second opinion that augments the deterministic detector with the semantic slop it cannot quantify (generated boilerplate that does not match intent, comments that merely restate code, cosmetic churn dressed up as substantive, a description that does not correspond to the diff).

Hard guarantees — AI assistance never changes who can be blocked

Only the deterministic core can ever block. The AI layer is structurally advisory:

  • the new ai_slop_advisory finding code is not recognised by isConfiguredGateBlocker, so it can never be a blocker;
  • severity is at most warning, never critical;
  • it never feeds slopRisk or the gate policy;
  • fail-safe on every path (AI off / no binding / over budget / unparseable / unsafe text → no finding, never throws).

How

  • src/services/ai-slop.tsrunGittensoryAiSlopAdvisory: one free Cloudflare Workers-AI call (reuses the ai-review daily-neuron budget window + public-safe sanitizer), returns at most one advisory SignalFinding.
  • Opt-in slopAiAdvisory setting wired through types, schema (migration 0034), repositories, focus-manifest (.gittensory.yml gate.slop.aiAdvisory) and the RepositorySettings OpenAPI schema. Runs only when slopGateMode != off and slopAiAdvisory.
  • processorsrunAiSlopForAdvisory appends the advisory finding, reusing the already-fetched changed files; deliberately does not touch slopRisk.

Drive-by fix

slop_gate_mode / slop_gate_min_score were absent from the settings upsert's onConflictDoUpdate SET clause, so slop settings silently did not persist on update of an existing row. Restored alongside the new field.

Tests

New ai-slop suite (parse / finding mapping / gating / fail-safe / can-never-block), processor wiring, focus-manifest aiAdvisory round-trip + resolve, and the DB persist-on-update round-trip. Typecheck clean; 97% coverage gate held; OpenAPI spec regenerated.

…cks)

Completes the slop feature (#716) with an opt-in AI second opinion that
augments the deterministic detector with the SEMANTIC slop it cannot
quantify: generated boilerplate that does not match intent, comments that
merely restate code, cosmetic churn dressed up as substantive, a
description that does not correspond to the diff.

Hard guarantees (AI assistance never changes who can be blocked — only the
deterministic core can block):
- the new `ai_slop_advisory` finding code is NOT recognised by
  isConfiguredGateBlocker, so it can never be a blocker;
- severity is at most `warning`, never `critical`;
- it never feeds slopRisk or the gate policy;
- fail-safe on every path (AI off / no binding / over budget / unparseable
  / unsafe text -> no finding, never throws).

- src/services/ai-slop.ts: runGittensoryAiSlopAdvisory — one free
  Workers-AI call (reuses the ai-review budget window + public-safe
  sanitizer), returns at most one advisory SignalFinding.
- opt-in `slopAiAdvisory` setting wired through types, schema (migration
  0034), repositories, focus-manifest (.gittensory.yml gate.slop.aiAdvisory)
  and the RepositorySettings OpenAPI schema. Runs only when
  slopGateMode != off AND slopAiAdvisory.
- processors: runAiSlopForAdvisory appends the advisory finding, reusing the
  already-fetched changed files; deliberately does NOT touch slopRisk.

Also fixes a latent bug: slop_gate_mode / slop_gate_min_score were absent
from the settings upsert's onConflictDoUpdate SET clause, so slop settings
silently did not persist on update of an existing row.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 14, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui d4effd8 Commit Preview URL

Branch Preview URL
Jun 14 2026, 03:09 PM

@ghost

ghost commented Jun 14, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #724 is no longer open. No action.

💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 14, 2026
@ghost

ghost commented Jun 14, 2026

Copy link
Copy Markdown

gittensory · advisory review

Reviewed 22 changed file(s) — two independent AI reviewers.

Suggested action: 🔍 Manual review. The changed route's preview could not be captured — review the rendered page manually before merging.

Reviewer A · gpt-oss-120b — recommends ✅ merge
The PR introduces an AI‑assisted slop advisory feature, adding a new repository setting, DB column, migration, schema updates, service implementation, processor wiring, and comprehensive tests. The implementation respects the public/private sanitizer and never influences gating, and the codebase compiles with updated types.

Suggestions

  • Add documentation for the new gate.slop.aiAdvisory setting in the repo's config guide.
  • Consider adding a UI toggle for slopAiAdvisory if configuration is exposed in the web UI.
  • Verify that the errorMessage import is present in src/queue/processors.ts to avoid runtime errors.

Worth double-checking

  • The new migration must be applied on production databases; ensure it runs before any code that expects the column.
  • Any code paths constructing RepositorySettings without the new field could cause TypeScript errors; double‑check all fixtures.

Reviewer B · nemotron-3-120b-a12b — recommends ✅ merge
The PR adds an AI-assisted slop advisory layer that runs as a non-blocking second opinion on PRs. It is opt-in via repository settings, uses Cloudflare Workers AI with budget limits, and its output is strictly advisory (never affects slopRisk or gating). The implementation includes proper fail-safes, public/private boundary sanitization, and comprehensive unit tests. All changes are consistent with the project's conventions and the public/private safety invariant.

No blocking issues spotted.

Warning

Could not capture a preview of the changed route(s) — review the rendered page manually before merging.

Before = production · After = this PR's preview deploy.

Route Viewport Before After
/ desktop before desktop after desktop
mobile before mobile after mobile

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored
JSONbored merged commit 32c72b7 into main Jun 14, 2026
12 checks passed
@JSONbored
JSONbored deleted the feat/ai-advisory-slop branch June 14, 2026 15:11
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 14, 2026
JSONbored added a commit that referenced this pull request Jun 14, 2026
Extends the AI slop advisory (#724) to optionally use the maintainer's own
frontier model (Anthropic/OpenAI) instead of free Workers AI, reusing the
existing per-repo encrypted key + aiReviewByok flag — one BYOK key serves
both AI features. Advisory-only either way; BYOK never changes whether the
slop pass can block (it can't).

- ai-review.ts: extract callAiProvider (shared BYOK HTTP/timeout/error
  handling) — runProviderReview now wraps it; export ProviderFailure +
  DEFAULT_BYOK_DAILY_REPO_LIMIT.
- repositories.ts: generalize countByokAiReviewEventsForRepoSince ->
  countByokAiEventsForRepoSince — one shared per-repo/day BYOK cap across
  ALL AI features (review + slop), so enabling more capabilities cannot
  multiply frontier spend.
- ai-slop.ts: providerKey path skips the free neuron budget, checks the
  shared BYOK cap, calls callAiProvider + parseSlopOpinion, records
  byok:<provider> usage. Workers-AI fallback unchanged. Fail-safe.
- processors runAiSlopForAdvisory: decrypt the repo key (a declared
  provider override must match) and pass it through.

Tests: BYOK provider path (provider used, Workers AI not) + shared BYOK cap
quota; existing Workers-AI gating/fail-safe still green. 97% coverage held.
@github-actions github-actions Bot mentioned this pull request Jun 14, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant