Repository navigation
fix(ai-gateway): keep data-collecting models out of Auto Efficient under data collection deny - #6728
Merged
Merged
Conversation
…der data collection deny Derive the set of models that train on prompts at every provider from the OpenRouter models-by-provider snapshot, deny those routing candidates to the auto-routing worker when the effective privacy denies data collection or requires ZDR, and use the same set for mayTrainOnYourPrompts in the catalog.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental change makes a failed snapshot read expire immediately so the auto router retries on the next call instead of caching an empty data-collection deny set for the TTL; the new regression test covers the retry path, and no new issues were found in the changed lines. Files Reviewed (4 files)
Previous Review Summary (commit 4b6a556)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 4b6a556)Status: 2 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (8 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
Do not cache a failed models-by-provider snapshot read for the TTL, so an empty data-collection set falls back to best-effort checks only until the next call. Use the global jest in tests whose jest.mock factories must be hoisted above imports.
johnnyeric
approved these changes
Sep 25, 2026
This was referenced Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kilo-auto/efficientandkilo-auto/balancedcould route to a model that only has data-collecting endpoints (for examplemeta/muse-spark-1.3-contributor) even when the organization or request denies data collection. OpenRouter then rejects the request because no endpoint matches the data policy.buildDataCollectionRequiredModelIdsderives the exact model variants that train on prompts at every provider from the stored models-by-provider snapshot. That snapshot contains OpenRouter's per-endpointdata_policy, normalized withwithWorstProviderDataPolicyandapplyFreeEndpointDataPolicy, and the change reusesgetSnapshotModelVariantIdandmodelTrains. The set is cached with the existing models-by-provider index loader.data_collection: 'deny'orzdr: true(checked withisDataCollectionExplicitlyDisallowed), the gateway adds routing candidates that require data collection todeniedModelIdsfor the auto-routing worker. A candidate counts as requiring data collection if it is in that set or matches the existinghasBestEffortGuessDataCollectionRequirementcheck.mayTrainOnYourPrompts: catalog models are now flagged when they are free or train on prompts at every provider. Before, only free models were flagged. Muse Spark Contributor now shows the data-collection disclosure, and the Teamsdata_collection: 'deny'catalog filter hides it.A model where only some providers train is not flagged. Under deny it can still be served through a non-training provider, so hiding it would be wrong.
Verification
apps/webtypecheck (tsgo) passes.mayTrainOnYourPrompts. CI runs them.Failure UX: a deny-list request no longer fails at OpenRouter after routing picks a model that can't serve it; the worker picks an eligible model up front. Genuine failures don't wait any longer: the extra lookup reuses cached data and runs in parallel with the policy lookup.