Repository navigation
fix(ai-gateway): apply retention and training options in BYOK gateway settings - #7975
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental change only hardens the existing BYOK/managed parity test with explicit gateway-options guards, and the assertions still match the current implementation. Files Reviewed (1 file)
Verification Notes
Verification Gaps
Previous Review Summaries (2 snapshots, latest commit 6dcfcf9)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 6dcfcf9)Status: No Issues Found | Recommendation: Merge Executive SummaryThe incremental change only adds a parity test asserting that BYOK and managed-routing gateway options agree for identical provider preferences; the test matches the current implementation and no defects were found. Files Reviewed (2 files)
Verification Notes
Verification Gaps
Previous review (commit db1d302)Status: No Issues Found | Recommendation: Merge Executive SummaryThe BYOK branch of Files Reviewed (2 files)
Verification Notes
Verification Gaps
Reviewed by deepseek-v4.1-flash-1017 · Input: 30.7K · Output: 1.7K · Cached: 197.1K Review guidance: REVIEW.md from base branch |
|
Approved, although these props are documented to not work for BYOK IIRC. |
|
bot: Thanks - that distinction is right, and the branch now treats caller-key traffic as its own contract. Gateway options for that path carry |
bot: Summary
Caller-key routing now has one supported combination for data handling preferences: the gateway options carry the training filter, and a request that also asks for zero data retention is answered with a 400 that points at managed routing. Managed routing is unchanged.
Changes
packages/web-shared/src/lib/ai-gateway/providers/vercel/index.ts: caller-key gateway options keeponly,sort,byok,modelsanddisallowPromptTraining, and no longer includezeroDataRetention. A new exported predicate identifies the request that is answered with the 400.packages/web-shared/src/lib/ai-gateway/handlers/llm-proxy.tsandpackages/web-shared/src/lib/ai-gateway/handlers/embeddings.ts: both caller-key paths return the 400 before any upstream request.packages/web-shared/src/lib/ai-gateway/llm-proxy-helpers.ts: the shared 400 response.providers/vercel/index.test.ts,handlers/llm-proxy.test.ts,handlers/embeddings.test.ts: coverage for the 400, the request that keeps its key, and the predicate matrix.Verification
NODE_ENV=test npx jest ../../packages/web-shared/src/lib/ai-gateway --runInBandinapps/web: 106 suites, 2031 tests passed.providers/vercel/index.test.ts,handlers/embeddings.test.tsandhandlers/llm-proxy.test.ts: 3 suites, 217 tests passed.pnpm --filter @kilocode/web-shared typecheck: clean.oxlinton the changed files: 0 warnings, 0 errors.oxfmt --list-different: clean.Proxy answers
The owner's proxy gave these answers in the owner's place.
Answer: One-time bypass (Recommended)
Confidence: 0.60 - Precedent: Autonomy: never accept blocked as an end state, and treat a block as a workflow bug. Session 55c9c80332a7: "blocked is not an acceptable end state". Git: merge main when a conflict needs it, per session a247f3c19b1e. The merge adds only content that is already on main and authors nothing that touches the excluded feature, so the bypass passes the "is this reasonable?" test (session 7f3470e0ba6f).
Answer: Reject ZDR on BYOK, keep training flag
Confidence: 0.60 - Precedent: Product scope: user-caused costs go to the user, not the platform; session d85d895b2835, owner chose "Charge the context's balance". Rejecting the no-training flag would block BYOK for whole organizations.
Answer: Chat and embeddings
Confidence: 0.65 - Precedent: Autonomy: fix the class on every affected surface; session 75f8833fe8c1, owner wrote "fix this for all shared services model pickers on all surfaces". Session 89824a222897 adds "if you saw a gap, fix it".