Skip to content

Deprecate Codestral-only keys#4000

Open
chrarnoldus wants to merge 4 commits into
mainfrom
christiaan/allow-codestral-mistral
Open

Deprecate Codestral-only keys#4000
chrarnoldus wants to merge 4 commits into
mainfrom
christiaan/allow-codestral-mistral

Conversation

@chrarnoldus

@chrarnoldus chrarnoldus commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Allow standard Mistral BYOK keys to route Codestral models through Mistral's FIM endpoint.
  • Preserve existing legacy Codestral-only keys, including their dedicated endpoint and priority when both key types are configured.
  • Stop offering legacy Codestral-only keys in the add-key dialog while keeping existing keys visible and editable.
  • Include Codestral models in the supported-model metadata shown for Mistral BYOK.

Verification

  • Not manually tested; the changes were verified with targeted linting and web type checking during implementation.

Visual Changes

N/A — the legacy Codestral-only provider option is removed from the add-key dropdown; existing key management remains unchanged.

Reviewer Notes

Existing Codestral-only keys remain backward compatible and take priority over standard Mistral keys. New configurations use the standard Mistral provider.

@chrarnoldus chrarnoldus self-assigned this Jun 12, 2026
Comment thread apps/web/src/app/api/fim/completions/route.ts
Comment thread apps/web/src/lib/ai-gateway/byok/index.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed incremental change that prevents adding new Codestral BYOK keys while preserving edit capability for existing keys. All previously flagged issues remain resolved.

Previously Resolved Issues
File Issue Status
apps/web/src/app/api/fim/completions/route.ts BYOK key priority not honoured — userByok?.at(0) picked oldest key by DB insertion order ✅ Fixed: now iterates byokProviderKeys in priority order and finds first match
apps/web/src/lib/ai-gateway/byok/index.ts Array.prototype.splice → prefer unshift ✅ Fixed in earlier commit
Files Reviewed (5 files)
  • apps/web/src/components/organizations/byok/BYOKKeysManager.tsx — no issues
  • apps/web/src/app/api/fim/completions/route.ts — previously resolved
  • apps/web/src/lib/ai-gateway/byok/index.ts — previously resolved
  • apps/web/src/routers/byok-router.ts — no issues
Previous Review Summaries (3 snapshots, latest commit 8cb7536)

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

Previous review (commit 8cb7536)

Status: No Issues Found | Recommendation: Merge

Executive Summary

All previously flagged issues have been resolved; the FIM route now correctly honours the ['codestral', 'mistral'] priority ordering when selecting a user BYOK key.

Previously Resolved Issues
File Issue Status
apps/web/src/app/api/fim/completions/route.ts BYOK key priority not honoured — userByok?.at(0) picked oldest key by DB insertion order ✅ Fixed: now iterates byokProviderKeys in priority order and finds first match
apps/web/src/lib/ai-gateway/byok/index.ts Array.prototype.splice → prefer unshift ✅ Fixed in earlier commit
Files Reviewed (4 files)
  • apps/web/src/app/api/fim/completions/route.ts — WARNING resolved
  • apps/web/src/lib/ai-gateway/byok/index.ts — no issues
  • apps/web/src/components/organizations/byok/BYOKKeysManager.tsx — no issues
  • apps/web/src/routers/byok-router.ts — no issues

Fix these issues in Kilo Cloud

Previous review (commit 9ab1e0d)

Status: 1 Issue Found | Recommendation: Address before merge

Executive Summary

The ['codestral', 'mistral'] priority ordering in the FIM route is still silently defeated by the DB query's orderBy(created_at), meaning a user with both keys may not get the expected key-to-endpoint routing.

Overview

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

WARNING

File Line Issue
apps/web/src/app/api/fim/completions/route.ts 158 BYOK key priority ordering ['codestral', 'mistral'] not honoured — DB returns rows by created_at, so userByok?.at(0) picks the oldest key, not the preferred codestral key
Previously Resolved Issues
File Issue Status
apps/web/src/lib/ai-gateway/byok/index.ts Array.prototype.splice → prefer unshift ✅ Fixed in latest commit
Files Reviewed (4 files)
  • apps/web/src/app/api/fim/completions/route.ts — 1 issue (WARNING, unchanged from previous review)
  • apps/web/src/lib/ai-gateway/byok/index.ts — suggestion resolved (spliceunshift)
  • apps/web/src/components/organizations/byok/BYOKKeysManager.tsx — no issues
  • apps/web/src/routers/byok-router.ts — no issues

Fix these issues in Kilo Cloud

Previous review (commit 34536a8)

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

The ['codestral', 'mistral'] priority ordering in the FIM route is silently defeated by the DB query's orderBy(created_at), meaning a user with both keys may not get the expected key-to-endpoint routing.

Overview

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

WARNING

File Line Issue
apps/web/src/app/api/fim/completions/route.ts 158 BYOK key priority ordering ['codestral', 'mistral'] not honoured — DB returns rows by created_at, so userByok?.at(0) picks the oldest key, not the preferred codestral key

SUGGESTION

File Line Issue
apps/web/src/lib/ai-gateway/byok/index.ts 32 providers.splice(0, 0, 'codestral') — unconventional; prefer providers.unshift('codestral') or ['codestral', ...providers]
Files Reviewed (4 files)
  • apps/web/src/app/api/fim/completions/route.ts — 1 issue
  • apps/web/src/lib/ai-gateway/byok/index.ts — 1 issue
  • apps/web/src/components/organizations/byok/BYOKKeysManager.tsx — no issues (rename of codestral entry to Legacy Codestral-only key and removal of (other models) suffix from mistral label)
  • apps/web/src/routers/byok-router.ts — no issues (removal of Codestral model filter from fetchSupportedModels so Codestral models now appear in the mistral provider list)

Fix these issues in Kilo Cloud


Reviewed by deepseek-v4-pro · 122,331 tokens

Review guidance: REVIEW.md from base branch main

Comment thread apps/web/src/lib/ai-gateway/byok/index.ts Outdated
@chrarnoldus chrarnoldus changed the title Allows Mistral byok to be used for Codestral feat(byok): route Codestral through Mistral keys Jun 15, 2026
@chrarnoldus chrarnoldus changed the title feat(byok): route Codestral through Mistral keys Deprecate Codestral-only keys Jun 15, 2026
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