fix(review): cache the AI slop advisory result per head SHA - #4025
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
❌ 51 Tests Failed:
View the top 3 failed test(s) by shortest run time
View the full list of 48 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-07 11:22:11 UTC
🛑 Suggested Action - Manual Review
Why this is blocked
CI checks failing
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 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.
|
runGittensoryAiSlopAdvisory made a real LLM call (up to 6 free-tier attempts, or a BYOK call) on every gate pass with no caching, so the scheduled re-gate sweep re-spent it on every tick even at an unchanged head. Confirmed in production: 1,469 ai_slop_pr calls in 24h across 3 repos, 110 of them on a single PR at the same head SHA. Adds ai_slop_cache keyed on (repo_full_name, pull_number, head_sha), mirroring ai_review_cache's shape but deliberately simpler: the slop advisory has no dynamic-context dimension (no RAG/grounding/enrichment feeds into it) and nothing analogous to a published GitHub artifact to protect against replaying, so a hit is unconditionally durable — no cacheable/cooldown columns needed. The cache is fingerprinted on which provider would answer (free-tier vs. a repo's BYOK key/model) so a config change still misses the cache, mirroring the observability shape of the existing AI-review cache (cache-hit/miss/write-error metrics and audit events).
caf2d2a to
9067be8
Compare
0119 was claimed by #4025 (ai_slop_cache), which merged first -- renumbered this migration to the next free number.
… window (#4032) * fix(review): persist linked-issue hard-rule violations past the grace window resolveLinkedIssueHardRule is fully re-evaluated from scratch every pass -- it re-parses linked issues from the PR's CURRENT body and reads each linked issue's CURRENT live state, with no memory of a prior pass's finding. During the flag-then-close verification window (settings.linkedIssueHardRules.closeDelaySeconds), that statelessness lets a confirmed violation dodge the close two ways: editing the PR body to strip the closing reference so the next pass sees zero linked issues, or the linked issue's live state changing (e.g. unassigned) between the violating pass and the verification pass. Add linkedIssueHardRuleViolatedAt/linkedIssueHardRuleViolationReason columns (mirroring draftConversionCount's never-resets discipline and mergeBlockedReason's pairing with mergeBlockedSha) so a PR that ever confirms a violation stays flagged for its lifetime, merged with the live re-parse result rather than replacing it. * fix(db): renumber linked-issue hard-rule migration to 0120 0119 was claimed by #4025 (ai_slop_cache), which merged first -- renumbered this migration to the next free number.
Summary
runGittensoryAiSlopAdvisorymade a real LLM call (up to 6 free-tier attempts, or a BYOK call) on every gate pass with zero caching, so the scheduled re-gate sweep re-spent it on every tick even at an unchanged head. Confirmed with a direct production query: 1,469ai_slop_prcalls in the last 24 hours across our 3 registered repos, with 110 calls on a single PR alone.This adds
ai_slop_cache, keyed on(repo_full_name, pull_number, head_sha), following the shape of the existingai_review_cache(seegetCachedAiReview/putCachedAiReviewinsrc/db/repositories.ts) but deliberately simpler: the slop advisory has no dynamic-context dimension the way AI review does (no RAG/grounding/enrichment feeds into it — its only inputs are the PR title/body/diff/deterministic band, all of which are already pinned to the head SHA) and nothing analogous to a "published" GitHub artifact to protect against replaying (its output folds into the same advisory pass that computes it, never stamped separately). So a cache hit here is unconditionally durable for a given head — nocacheable/published_atcooldown columns, unlikeai_review_cache.The cache is fingerprinted on the one input that CAN change independently of the head SHA: which provider would answer (free/default reviewer vs. a repo's BYOK key/model), so toggling BYOK or changing its provider/model correctly misses a stale cache row instead of replaying an opinion from a different reviewer.
Observability mirrors the
ai_review_cachehouse style:gittensory_ai_slop_cache_hit_total/_miss_total/_write_error_totalmetrics, andgithub_app.ai_slop_cache_hit/_miss/_write_erroraudit events.No issue because: this is a small, self-evident production bug fix backed by direct production data (
linkedIssuePolicyon this repo ispreferred, not required, and this fix is narrowly scoped to one call site).Operational follow-up (not part of this PR):
gate.slop.aiAdvisorywas disabled as an emergency stopgap on the self-hosted VPS config for all 3 repos while this bug was live. Once this PR is merged and deployed, it should be re-enabled — that's a VPS config change outside this PR's scope.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally; 100% line AND branch coverage confirmed on every changed line across all 5 touched/addedsrc/**files (verified via a full ~10,600-test clean run'scoverage/lcov.info, cross-checked against the exact changed-line ranges).npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderatetest/unit/ai-slop-cache.test.ts(new, dedicated repository-function + fingerprint tests) andtest/unit/ai-slop.test.ts(cache-hit/miss/write-back wiring, fail-safe on read/write throws including a doubly-nested failure, BYOK-toggle cache invalidation, and the pre-existing 42 tests all still pass unmodified), plus atest/unit/schema-timestamp-defaults.test.tscase for the new table's Drizzle$defaultFn.Safety
ui:openapi:checkconfirms no drift.UI Evidencesection. N/A — no visible/UI change.Notes
0119_ai_slop_cache.sqlre-verified as the correct next-free number immediately before every push, given very active concurrent development on this repo (main moved several times over the course of this change).