Skip to content

Expose autocomplete models in organization selectors - #5127

Merged
chrarnoldus merged 2 commits into
mainfrom
fix-autocomplete-model-selectors
Aug 7, 2026
Merged

Expose autocomplete models in organization selectors#5127
chrarnoldus merged 2 commits into
mainfrom
fix-autocomplete-model-selectors

Conversation

@chrarnoldus

@chrarnoldus chrarnoldus commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • define the exact supported FIM/edit model catalog for Codestral 2508 and Mercury Edit 2
  • augment the provider snapshot with those models under Mistral and Inception so organization model/provider selectors and Enterprise restrictions share the correct associations
  • reject unknown FIM/edit aliases instead of accepting arbitrary provider-prefixed model IDs
  • add regression coverage for selector visibility, provider filtering, restriction lookup, deduplication, and alias rejection

Verification

  • pnpm --filter web exec jest --runInBand src/lib/ai-gateway/supported-fim-models.test.ts src/app/api/fim/completions/route.test.ts src/app/api/edit/completions/route.test.ts (28 tests passed)
  • pnpm --filter web run typecheck
  • pnpm --filter web run lint
  • pnpm format
  • pnpm format:check
  • git diff --check origin/main...HEAD

Independence

This branch was created from current origin/main and contains only commit 2e4007676; it does not contain commits from PR #5106 / fix/enterprise-model-snapshot.

@chrarnoldus chrarnoldus self-assigned this Aug 7, 2026
Comment thread apps/web/src/lib/ai-gateway/supported-fim-models.ts Outdated
Comment thread apps/web/src/lib/ai-gateway/supported-fim-models.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Follow-up commit f15cc69f1 fully resolves both previous suggestions: missing-provider injection now emits a console.warn, and the snapshot injection deep-copies modalities, endpoint, pricing, and data policy (verified complete against the canonical zod schema and the applyFreeEndpointDataPolicy mutation point), with regression tests covering both behaviors.

Files Reviewed (2 files)
  • apps/web/src/lib/ai-gateway/supported-fim-models.ts
  • apps/web/src/lib/ai-gateway/supported-fim-models.test.ts
Previous Review Summary (commit 2e40076)

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

Previous review (commit 2e40076)

Status: 2 Issues Found | Recommendation: Address before merge

Executive Summary

Well-tested change that correctly hardcodes the FIM/edit model catalog, rejects aliases, and injects the models into the provider snapshot; the two findings are minor robustness gaps in the new snapshot-injection helper, neither of which blocks the fix.

Overview

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

SUGGESTION

File Line Issue
apps/web/src/lib/ai-gateway/supported-fim-models.ts 85 Injection silently no-ops (no log/fallback) if OpenRouter lacks a mistral/inception provider entry, reintroducing the selector-visibility bug undetected
apps/web/src/lib/ai-gateway/supported-fim-models.ts 88 Shallow copy aliases the module constant's nested endpoint object, which applyFreeEndpointDataPolicy can mutate in place for the process lifetime
Files Reviewed (7 files)
  • apps/web/src/lib/ai-gateway/supported-fim-models.ts - 2 issues
  • apps/web/src/lib/ai-gateway/supported-fim-models.test.ts
  • apps/web/src/lib/ai-gateway/providers/openrouter/sync-providers.ts
  • apps/web/src/app/api/fim/completions/route.ts
  • apps/web/src/app/api/fim/completions/route.test.ts
  • apps/web/src/app/api/edit/completions/route.ts
  • apps/web/src/app/api/edit/completions/route.test.ts

Verified: injected OpenRouterModel shape matches the canonical zod schema; provider slugs mistral/inception align with the existing OpenRouterInferenceProviderIdSchema; enterprise decision path (getEffectiveModelDecision), provider allow-list predicate, free-endpoint data policy, and worst-provider data policy all interact safely with the injected entries; route behavior for billing, BYOK, promo, and org restrictions is unchanged for the two exact catalog IDs; no memory-leak vectors introduced (no timers/listeners/global mutable growth; per-sync arrays only).

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 27.6K · Output: 3.2K · Cached: 111.6K

Review guidance: REVIEW.md from base branch main

@chrarnoldus
chrarnoldus merged commit d95da92 into main Aug 7, 2026
13 of 15 checks passed
@chrarnoldus
chrarnoldus deleted the fix-autocomplete-model-selectors branch August 7, 2026 11:50
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