Repository navigation
feat(gateway): replace Kilo catalog from Gateway and enforce team scope - #15065
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental re-review of The four counter-AI findings left in the PR discussion were checked against current HEAD: the retry self-interrupt and the stray Files Reviewed (8 files)
Previous Review Summaries (7 snapshots, latest commit 0408727)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 0408727)Status: No Issues Found | Recommendation: Merge Incremental re-review of All previously reported findings are now resolved in current code: the catalog decode validates entries individually ( Files Reviewed (2 files)
Previous review (commit ca6ff16)Status: 1 Suggestion Found | Recommendation: Merge Re-reviewed the incremental commits ending at Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (5 files)
Fix these issues in Kilo Cloud Previous review (commit f570126)Status: No Issues Found | Recommendation: Merge Re-reviewed the incremental commits Files Reviewed (1 file)
Previous review (commit f4a3360)Status: No Issues Found | Recommendation: Merge Re-reviewed the incremental commit Files Reviewed (1 file)
Previous review (commit fe81421)Status: No Issues Found | Recommendation: Merge Re-reviewed the incremental commit Files Reviewed (3 files)
Previous review (commit 4afef24)Status: No Issues Found | Recommendation: Merge The follow-up commit resolved all prior findings: per-entry catalog validation ( Files Reviewed (4 files)
Previous review (commit 4ee771b)Status: 6 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (8 files)
Reviewed by deepseek-v4.1-flash · Input: 61.7K · Output: 23.7K · Cached: 637.6K |
…and address review feedback
…llback for defaults
…ults fallback field
|
counter-AI findings: 1. Retry chain self-cancels on the second attempt — backoff ladder is effectively broken
I reproduced this with a probe replicating the exact scheduling structure (same
Fix: clear 2. Testing fixture constructs an invalid header name (throws in Bun) — latent
3. Stored last-good catalog is cast without revalidation (robustness)
4. Successful-but-empty catalog indistinguishable from failure (minor)
Everything else checks out against the repo at the PR head: |
e6f7679 to
c784b0f
Compare
|
@WebReflection 1 and 2 are fixed. 3 and 4 I decided not to over-engineer now. Thanks. |
Stacked on #15064.
Part of #14991 (and #13750), PR 2 of the Gateway series. Plan unit
U-E1-04(catalog authority).What Problem This Solves
In PR 1 (#15064), the
kiloprovider still inherited its model list from the bundledmodels.devseed:/api/organizations/{id}/models) and team default models (/api/organizations/{id}/defaults) were not fetched or enforced.models.devlist instead of the Gateway'sisFree === truecatalog.Why This Change Was Made
Following the architecture in #14991 and #15060:
packages/kilo-gateway-core(src/models.ts,src/defaults.ts):GET /api/openrouter/models, with 401 fallback to the anonymous free catalog when!organizationID) and team (GET /api/organizations/{id}/models) catalogs.context_length, output limit (top_provider.max_completion_tokens ?? max_completion_tokens ?? Math.ceil(context_length * 0.2)), tool support (supportsTools, treating missing or emptysupported_parametersas tool-capable per v1c4506f7ef87), finite non-negative per-million pricing (cost), input/output modalities,opencode.variants,opencode.ai_sdk_provider(anthropic,openai,openai-compatible,openrouter),opencode.prompt, and metadata (isFree,recommendedIndex,hasUserByokAvailable,mayTrainOnYourPrompts,autoRouting,terminalBench,description,reasoning,family).kilo-auto/smallto the top-priority small-model family soModel.small("kilo")selectskilo-auto/smallfor title generation and utility tasks./api/defaults(personal/anonymous) and/api/organizations/{id}/defaults(team) with fallback tokilo-auto/frontier(signed in) orkilo-auto/free(signed out).30 * 2^min(attempt, 4)up to 300s, honoringRetry-After).packages/core/src/kilocode/gateway.ts(editor.add/models.set):kilomodel list completely from the Gateway response on startup, login, logout,credential.switched,organization.set, and a 5-minute refresh timer;models.devmodels never leak through.catalog:personal:<hash>/catalog:anonymous:<server>) in plugin storage (without storing tokens) and serves it on transient fetch failure; never falls back tomodels.dev.models: [],activation: "disabled", sentinelsourceConnection, andmodel.transformremoval soConfigProviderPlugininpostcannot re-enable static models under a failed team scope).isFree === trueonly and suppresses uncredentialed OpenCode Zen (apiKey === "public") soModel.default()selects Kilo's free default model (kilo/kilo-auto/free).packages/core/src/kilocode/gateway-rpc.ts):modelsmethod tokilocode.gatewayreturningKiloModels.Entry[]metadata (isFree,recommendedIndex,hasUserByokAvailable,mayTrainOnYourPrompts,autoRouting,terminalBench,description,reasoning,family,prompt,aiSDKProvider).Shared upstream files changed
None in this PR (all changes are in Kilo-owned paths
packages/kilo-gateway-core/**andpackages/core/**/kilocode/**).User Impact
modelsCLI command show only the Kilo Gateway's free models (isFree === true, 14 models on production Gateway) and default tokilo/kilo-auto/free./api/defaults(kilo/kilo-auto/frontier)./api/organizations/{id}/modelsand fails closed if the team catalog cannot be fetched.Evidence
Automated checks
bun script/check-opencode-annotations.ts:ok (39 shared files against 4d9678a79d6)bun script/check-shared-patches.ts:ok(0 new shared upstream files touched)bun run --cwd packages/kilo-gateway-core typecheck && bun run --cwd packages/kilo-gateway-core build: passbun run --cwd packages/core typecheck: passbun run --cwd packages/tui typecheck: passbun test --cwd packages/kilo-gateway-core: 25 pass, 0 fail (83 assertions)bun test --cwd packages/core test/kilocode/gateway.test.ts test/plugin/provider-kilo.test.ts: 12 pass, 0 fail (53 assertions)CLI & TUI Self-Test
bun dev models --standalone):kilo/kilo-auto/free,kilo/openrouter/free, etc.) and 0 paid models (kilo/anthropic/claude-sonnet-4.6absent).KILO_API_KEY): returns 328 Gateway models includingkilo/anthropic/claude-sonnet-4.6andkilo/kilo-auto/frontier.