You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
review: third (small) profile so S can run lighter than M - #249
Adds KAI_REVIEW_PROFILE_SMALL (+ KAI_REVIEW_SMALL_LEVELS, default S), checked ahead of the low-risk profile. Unset, behaviour is unchanged. Lets the server's open-weight Auto send S to light@1 and M to standard-open@1 (kai-server#633).
Note: TestReviewWithNoNewSettingsMatchesMain fails on main too (unrelated).
Written by Kai from the change itself. Kai only edits this section; everything above it is the author's.
Adds an optional third "small" review profile, set with KAI_REVIEW_PROFILE_SMALL and KAI_REVIEW_SMALL_LEVELS (default S). It is checked ahead of the low-risk profile, so S can run lighter than M. With the variable unset, behaviour is unchanged.
Changes
Level routing (review_commit_profile.go): new rcSmallRiskLevel(level) returns true when KAI_REVIEW_PROFILE_SMALL is set and the level is in the comma-separated KAI_REVIEW_SMALL_LEVELS. Matching is case-insensitive and ignores whitespace. An empty level never matches.
Profile loading (review_commit_profile.go):rcLoadProfileForRisk tries the small profile first, then the low-risk profile, then falls back to rcLoadProfileFor. A level listed for both small and low-risk therefore loads the small profile.
Review command (review_commit.go): the pre-review risk line on stderr now also prints when only KAI_REVIEW_PROFILE_SMALL is set, and can report "small profile". The lowRisk flag is false when the small profile applies.
Run record (review_commit_run.go, review_commit.go): new rcProfileSmall = "small" constant. runReviewCommit passes it to rcRunStart as the profile name when the small profile applies.
Testing
New TestLoadProfileForRiskSmall writes high, low-risk and small profiles with low-risk levels S,M. It checks:
With no small profile set, S still resolves to the low-risk model.
With the small profile set, S loads the small model, M the low-risk model, and L and unrated changes the base profile.
KAI_REVIEW_SMALL_LEVELS=s, m moves M to the small profile.
A missing small profile file returns an error.
The fake-model test helper rcFakeReviewEnv and TestReviewRunReport_ReviewAgainstFakeModelServer now clear KAI_REVIEW_PROFILE_SMALL (and KAI_REVIEW_SMALL_LEVELS in the helper), so the environment doesn't leak into those tests.
KAI_REVIEW_PROFILE_SMALL + KAI_REVIEW_SMALL_LEVELS (default S) are checked
before the low-risk profile. Unset, nothing changes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Kai review · Ready to merge (9/10)
Read the whole thing — it does what it says, and nothing jumped out at me.
Next: merge when your checks are green — I found nothing to fix.
To get to 10/10
−1 · tidy 1 nit (folded below)
1 nit · real, but none of them changes what the code does
cmd/kai/review_commit_run.go:129 — The doc comment on rcRunReport.Profile still lists the values as "low_risk, standard (any other profile), or none", but runReviewCommit now writes rcProfileSmall ("small"), which the comment omits and its "any oth…
cmd/kai/review_commit_risk_test.go: TestLoadProfileForRisk and the added TestLoadProfileForRiskSmall
cmd/kai/review_commit_fakemodels_test.go rcFakeReviewEnv env clearing and cmd/kai/review_commit_run_test.go run-report assertions
Findings
nit: cmd/kai/review_commit_run.go:129 — The doc comment on rcRunReport.Profile still lists the values as "low_risk, standard (any other profile), or none", but runReviewCommit now writes rcProfileSmall ("small"), which the comment omits and its "any other profile" clause contradicts.
The comment on rcRunReport.Profile in cmd/kai/review_commit_run.go enumerates the field's values as low_risk, standard (any other profile), or none. runReviewCommit now sets the field to rcProfileSmall ("small") for small-routed changes, so the comment is wrong for that value.
Remedy: Update the comment at cmd/kai/review_commit_run.go:128-129 to list small alongside low_risk, standard and none.
Size M · Risk M · +82 −5 · 6 files · reaches 81 · the full analysis · Reply to any of my comments and I'll answer, or say @kaicontext anywhere on this PR — a question, or "take another look at the retry logic". · Some repos review new pushes only when asked. Comment @kaicontext review any time for a review right away.
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
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.
Adds KAI_REVIEW_PROFILE_SMALL (+ KAI_REVIEW_SMALL_LEVELS, default S), checked ahead of the low-risk profile. Unset, behaviour is unchanged. Lets the server's open-weight Auto send S to light@1 and M to standard-open@1 (kai-server#633).
Note: TestReviewWithNoNewSettingsMatchesMain fails on main too (unrelated).
🤖 Generated with Claude Code
Kai context
Written by Kai from the change itself. Kai only edits this section; everything above it is the author's.
Adds an optional third "small" review profile, set with
KAI_REVIEW_PROFILE_SMALLandKAI_REVIEW_SMALL_LEVELS(defaultS). It is checked ahead of the low-risk profile, so S can run lighter than M. With the variable unset, behaviour is unchanged.Changes
review_commit_profile.go): newrcSmallRiskLevel(level)returns true whenKAI_REVIEW_PROFILE_SMALLis set and the level is in the comma-separatedKAI_REVIEW_SMALL_LEVELS. Matching is case-insensitive and ignores whitespace. An empty level never matches.review_commit_profile.go):rcLoadProfileForRisktries the small profile first, then the low-risk profile, then falls back torcLoadProfileFor. A level listed for both small and low-risk therefore loads the small profile.review_commit.go): the pre-review risk line on stderr now also prints when onlyKAI_REVIEW_PROFILE_SMALLis set, and can report "small profile". ThelowRiskflag is false when the small profile applies.review_commit_run.go,review_commit.go): newrcProfileSmall = "small"constant.runReviewCommitpasses it torcRunStartas the profile name when the small profile applies.Testing
TestLoadProfileForRiskSmallwrites high, low-risk and small profiles with low-risk levelsS,M. It checks:KAI_REVIEW_SMALL_LEVELS=s, mmoves M to the small profile.rcFakeReviewEnvandTestReviewRunReport_ReviewAgainstFakeModelServernow clearKAI_REVIEW_PROFILE_SMALL(andKAI_REVIEW_SMALL_LEVELSin the helper), so the environment doesn't leak into those tests.