Skip to content

Remove abuse service from AI gateway paths - #6087

Merged
chrarnoldus merged 5 commits into
mainfrom
kilo/remove-ai-gateway-abuse-service
Sep 18, 2026
Merged

chrarnoldus merged 5 commits into
mainfrom
kilo/remove-ai-gateway-abuse-service

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

  • remove abuse classification calls and cached rules-engine enforcement from the shared AI gateway route
  • remove abuse cost reporting from usage processing
  • retain non-gateway auth and lifecycle event reporting plus nullable legacy usage metadata for compatibility

Validation

  • pnpm format:changed
  • local tests intentionally not run; CI will validate the change

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@chrarnoldus chrarnoldus self-assigned this Sep 11, 2026
@kilo-code-bot

kilo-code-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Incremental re-review of the single commit added since the last review (401f1feb, "restore ChatGPT reconnect rationale") found no issues: the change adds only two explanatory comments above the existing chatgpt-reconnect early return, with no executable code modified.

Files Reviewed (1 changed file in incremental diff)
  • apps/web/src/app/api/openrouter/[...path]/route.ts (lines 674-675: comments only)

The other 8 files in the PR diff are unchanged since the previous reviewed SHA 6ca56df and were not re-analyzed.

Previous Review Summaries (2 snapshots, latest commit 6ca56df)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 6ca56df)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Incremental re-review of the only commit added since the last review (6ca56df, let → const for effectiveProviderContext) plus merges from main: the change is correct because the variable is assigned exactly once, and all previously removed abuse-service symbols remain unreferenced at current HEAD.

Files Reviewed (9 files)
  • apps/web/src/app/api/openrouter/[...path]/route.ts
  • apps/web/src/app/api/openrouter/[...path]/route.test.ts
  • apps/web/src/lib/ai-gateway/abuse-service.ts
  • apps/web/src/lib/ai-gateway/processUsage.ts
  • apps/web/src/lib/ai-gateway/processUsage.test.ts
  • apps/web/src/lib/ai-gateway/processUsage.types.ts
  • apps/web/src/lib/ai-gateway/providers/upstream-attempt.ts
  • apps/web/src/lib/proxy-error-types.ts
  • apps/web/src/lib/redis-keys.ts

Previous review (commit ec8e885)

Status: No Issues Found | Recommendation: Merge

Executive Summary

This PR cleanly removes the shared AI-gateway abuse classification, quarantine/rules-engine enforcement, and abuse cost reporting; I verified every removed export and field has no remaining references and that the retained provider/route code is internally consistent.

Files Reviewed (9 files)
  • apps/web/src/app/api/openrouter/[...path]/route.ts
  • apps/web/src/app/api/openrouter/[...path]/route.test.ts
  • apps/web/src/lib/ai-gateway/abuse-service.ts
  • apps/web/src/lib/ai-gateway/processUsage.ts
  • apps/web/src/lib/ai-gateway/processUsage.test.ts
  • apps/web/src/lib/ai-gateway/processUsage.types.ts
  • apps/web/src/lib/ai-gateway/providers/upstream-attempt.ts
  • apps/web/src/lib/proxy-error-types.ts
  • apps/web/src/lib/redis-keys.ts

Verified: no remaining references to the removed classifyAbuse/reportAbuseCost/rules-engine helpers or abuseRulesClassificationRedisKey; ProxyErrorType.abuse_blocked and the delayMs propagation are fully removed; effectiveModelIdLowerCased/accessCheckResolver are no longer reassigned so const is correct; remaining abuse_delay/abuse_downgraded_from nulls keep DB compatibility; the updated classifier-billing test matches the 400 returned by apiKindNotSupportedResponse. Tests were not executed (read-only review).


Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

…y-abuse-service

# Conflicts:
#	apps/web/src/app/api/openrouter/[...path]/route.test.ts

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
chrarnoldus and others added 3 commits September 18, 2026 03:25
…y-abuse-service

# Conflicts:
#	apps/web/src/app/api/openrouter/[...path]/route.test.ts
#	apps/web/src/app/api/openrouter/[...path]/route.ts

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants