Skip to content

fix(ai-gateway): exclude Laguna from Vercel routing - #4918

Merged
chrarnoldus merged 2 commits into
mainfrom
aboard-plant
Jul 31, 2026
Merged

fix(ai-gateway): exclude Laguna from Vercel routing#4918
chrarnoldus merged 2 commits into
mainfrom
aboard-plant

Conversation

@chrarnoldus

@chrarnoldus chrarnoldus commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep models containing laguna out of random Vercel AI Gateway routing
  • document the Vercel BYOK compatibility issue

Verification

  • pnpm exec oxlint --config .oxlintrc.json apps/web/src/lib/ai-gateway/providers/vercel/index.ts apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts
  • git diff --check

@chrarnoldus chrarnoldus self-assigned this Jul 31, 2026
Comment thread apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The incremental commit broadens the Laguna exclusion in shouldRouteToVercel to a includes('laguna') substring check and deletes the previously flagged ineffective regression test; high confidence that no changed-code defects remain.

Notes
  • Previous SUGGESTION on index.test.ts:25 is resolved: the test that would have passed with or without the guard was removed rather than strengthened, so the guard is now untested but no misleading coverage remains.
  • requestedModel.includes('laguna') is case-sensitive; callers pass an already-lowercased public model id, and both catalog ids (poolside/laguna-s-2.1:free, poolside/laguna-m.1:free) match, so the guard still fires for every Laguna variant, including :free and any future suffixes.
  • Broadening from a poolside/laguna- prefix to a bare substring also excludes any hypothetical non-Poolside or custom-LLM model whose id contains laguna from random Vercel routing. That over-match only forces OpenRouter/default routing, so it is fail-safe with respect to the BYOK bug being worked around.
  • checkVercelBYOK runs earlier in getProvider and is unaffected, but poolside is absent from VercelUserByokInferenceProviderIdSchema, so no user-BYOK path can route Laguna through Vercel.
  • Test-file imports (GatewayRequest, getRandomNumber) are still used by the remaining suites after the deletion, so no unused-import or compile breakage.
Files Reviewed (2 files)
  • apps/web/src/lib/ai-gateway/providers/vercel/index.ts
  • apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts
Previous Review Summary (commit f786939)

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

Previous review (commit f786939)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The routing guard itself is correct, but the new regression test in vercel/index.test.ts would still pass if the guard were removed, so it provides no protection.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts 25 Test asserts false but all Redis-backed helpers fall back to empty/default values in Jest, so shouldRouteToVercel returns false for any model with or without the new poolside/laguna- guard
Notes
  • The guard is placed in shouldRouteToVercel, which only covers random (non-BYOK) Vercel routing. checkVercelBYOK runs earlier in getProvider and is unaffected, but poolside is not in VercelUserByokInferenceProviderIdSchema, so no user-BYOK path can route Laguna to Vercel today. No gap found.
  • poolside/laguna- matches both catalog ids in the repo (poolside/laguna-s-2.1:free, poolside/laguna-m.1:free), and route handlers pass a lowercased model id, so the prefix check holds.
Files Reviewed (2 files)
  • apps/web/src/lib/ai-gateway/providers/vercel/index.ts - 0 issues
  • apps/web/src/lib/ai-gateway/providers/vercel/index.test.ts - 1 issue

Fix these issues in Kilo Cloud


Reviewed by claude-opus-5 · Input: 32 · Output: 4.5K · Cached: 614.7K

Review guidance: REVIEW.md from base branch main

@chrarnoldus
chrarnoldus merged commit b6d9f56 into main Jul 31, 2026
16 checks passed
@chrarnoldus
chrarnoldus deleted the aboard-plant branch July 31, 2026 12:20
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