feat: Make Sonnet 4.6 free for one week in review mode#295
feat: Make Sonnet 4.6 free for one week in review mode#295kiloconnect[bot] wants to merge 1 commit intomainfrom
Conversation
- Add claude-sonnet-4-6-20250514 as a free promotional model for Code Reviewer - Promotion window: 2026-02-18 to 2026-02-25 (7 days) - Model is hidden from public model list (review_only flag) - Only accessible through internal API (Code Reviewer) during promotion - Add promotion tracking admin endpoint (getReviewPromotionStats) - Add structured logging for promotion model usage
| */ | ||
| export function getDefaultCodeReviewModel(): string { | ||
| const promoModel = getActiveReviewPromotionModel(); | ||
| return promoModel?.internal_id ?? BASE_CODE_REVIEW_MODEL; |
There was a problem hiding this comment.
CRITICAL: getDefaultCodeReviewModel() returns internal_id instead of public_id, which means the promotional model will not be recognized as free by the API route.
The API route at src/app/api/openrouter/[...path]/route.ts uses the model ID to check isFreeModel(), isReviewOnlyModel(), and isRateLimitedModel() — all of which match against public_id. The applyProviderSpecificLogic() function in src/lib/providers/index.ts:243 then rewrites requestToMutate.model from public_id → internal_id before sending to OpenRouter.
By returning internal_id here, the model bypasses the review-only access gate and isn't recognized as free, so users will be charged credits for what's supposed to be a free promotional model.
For reference, the Slack integration correctly uses public_id (opus_46_free_slackbot_model.public_id) in src/lib/integrations/slack-service.ts:20.
| return promoModel?.internal_id ?? BASE_CODE_REVIEW_MODEL; | |
| return promoModel?.public_id ?? BASE_CODE_REVIEW_MODEL; |
| and( | ||
| gte(cloud_agent_code_reviews.created_at, promoStart), | ||
| lt(cloud_agent_code_reviews.created_at, promoEnd), | ||
| eq(cliSessions.last_model, promoModelId) |
There was a problem hiding this comment.
WARNING: This query matches last_model against promoModel.internal_id. If the critical bug in getDefaultCodeReviewModel() is fixed to return public_id instead of internal_id, then last_model in the DB will store the public_id (e.g. anthropic/claude-sonnet-4-6-20250514:review), and this query will need to match on public_id as well.
Consider using promoModel.public_id here to stay consistent with the fix, or add a comment clarifying which ID format last_model stores.
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (7 files)
|
Summary
Make Claude Sonnet 4.6 (
claude-sonnet-4-6-20250514) free for one week in Code Reviewer (review mode).Promotion window: 2026-02-18 00:00 UTC → 2026-02-25 00:00 UTC (7 days)
Changes
Free model promotion (following PR #27 patterns)
sonnet_46_free_review_modelinsrc/lib/providers/anthropic.tswithreview_only: trueflagKiloFreeModeltype withreview_only,promotion_start, andpromotion_endfieldskiloFreeModelsarray insrc/lib/models.tsslackbot_only)Promotion-aware model selection
getDefaultCodeReviewModel()function that returns the promotional model during the active windowprepare-review-payload.tsto use the promotion-aware model selectionTracking & Reporting
getReviewPromotionStatstRPC query in the admin code reviews router that reports:isReviewOnlyModel(),isReviewPromotionActive(),getActiveReviewPromotionModel()Access control
internalApiUse)promotion_end, the model returns "does not exist"skipBalanceCheck: trueFiles changed
src/lib/providers/kilo-free-model.ts— Extended type withreview_only,promotion_start,promotion_endsrc/lib/providers/anthropic.ts— Addedsonnet_46_free_review_modeldefinitionsrc/lib/models.ts— Registered model + added helper functionssrc/lib/providers/openrouter/index.ts— Filter review-only models from public listsrc/app/api/openrouter/[...path]/route.ts— Access control for review-only modelssrc/lib/code-reviews/core/constants.ts— Promotion-awaregetDefaultCodeReviewModel()src/lib/code-reviews/triggers/prepare-review-payload.ts— Use promotion model + tracking logssrc/routers/admin-code-reviews-router.ts—getReviewPromotionStatsadmin endpointTesting
Built for alex.alecu by Kilo for Slack