Skip to content

review: third (small) profile so S can run lighter than M - #249

Merged
jschatz1 merged 1 commit into
mainfrom
feat/review-profile-small
Nov 16, 2026
Merged

jschatz1 merged 1 commit into
mainfrom
feat/review-profile-small

Conversation

@jschatz1

@jschatz1 jschatz1 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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_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>

@kaicontext kaicontext Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewView in KaiKai 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…
Important files changed
File Change
cmd/kai/review_commit.go modified · +12 −4
cmd/kai/review_commit_fakemodels_test.go modified · +1 −1
cmd/kai/review_commit_profile.go modified · +26 −0
cmd/kai/review_commit_risk_test.go modified · +41 −0
cmd/kai/review_commit_run.go modified · +1 −0
cmd/kai/review_commit_run_test.go modified · +1 −0
How I reviewed it — 6 files, 7 turns, 36s

0 confirmed findings, 2 refuted. Intent verified.

What I opened

  • cmd/kai/review_commit.go
  • cmd/kai/review_commit_fakemodels_test.go
  • cmd/kai/review_commit_profile.go
  • cmd/kai/review_commit_risk_test.go
  • cmd/kai/review_commit_run.go
  • cmd/kai/review_commit_run_test.go
Full read-through

Scope

  • cmd/kai/review_commit.go: runReviewCommit profile selection, stderr risk message and run-report profile (lines 389-452)
  • cmd/kai/review_commit_profile.go: rcLoadProfileForRisk, rcLoadProfileFile, rcLoadProfileFor, rcSmallRiskLevel next to rcLowRiskLevel (lines 205-321)
  • cmd/kai/review_commit_run.go: rcProfile* constants, rcRunReport.Profile doc comment, rcRunStart and rcRunProfile (lines 122-280)
  • 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.

@jschatz1
jschatz1 merged commit 9e074ea into main Nov 16, 2026
7 checks passed
@jschatz1
jschatz1 deleted the feat/review-profile-small branch November 16, 2026 11:53
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.

1 participant