Repository navigation
[AISAGE-733] fix(ai-gateway): include provider explanation in specific BYOK errors - #8115
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental commit only rewords the BYOK warning comment; the new wording accurately reflects that Files Reviewed (1 file)
Previous Review Summary (commit af9ada6)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit af9ada6)Status: 1 Issue Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)SUGGESTION
Files Reviewed (2 files)
The functional change itself looks sound: the specific 401/402/403/429 messages keep their fixed prefix, upstream text goes through the existing schema plus control-character stripping and 300-char cap, precedence over provider-not-allowed and context-overflow detection is unchanged, and the added tests cover the OpenCode Go 403, 401, and sanitization paths. Reviewed by deepseek-v4.1-flash-1017 · Input: 28.9K · Output: 1.9K · Cached: 197.4K Review guidance: REVIEW.md from base branch |
Problem
For BYOK 401/402/403/429 responses the gateway replaces the upstream error with a fixed, status-based message and drops what the provider actually said. A user with an expired OpenCode Go key saw:
while the upstream response was:
{"error":{"type":"authentication_error","code":"api_key_expired","message":"This API key has expired. Create a new API key in OpenCode Console and replace it in your client or secret store. Signing in again will not renew this key."}}"Invalid or revoked" was misleading here, and the provider's own fix-it instructions were lost. Found via request
25bhr-1792418280888-96a15ecf80d4(api_request_log15130364).Change
<our message> Provider message: <provider message>.error.messageormessage, control characters stripped, capped at 300 chars.byok_invalid_keyclassification and the code-review unretryable-message check both useincludes).Responding with …warning still logs only our fixed message, so the line stays stable to search on. The upstream body was already logged bycaptureProxyErrorbefore this change.Verification
jest packages/web-shared/src/lib/ai-gateway/llm-proxy-helpers.test.ts apps/web/src/lib/code-reviews/action-required.test.ts: 189 passedpnpm --filter @kilocode/web-shared typecheck