Repository navigation
[MM: XX.2.M] Give The Claude Turn An Advisor Model - #2229
jaywedgeworth22 wants to merge 3 commits into
Conversation
The Claude Code CLI can consult a second model as an advisor, but the way to turn that on from a chat is denied twice in the driver, because a bare /advisor opus that reached the CLI rewrote advisorModel in the owner's global ~/.claude/settings.json. The flag form has no such problem: --advisor <model> is per launch, so it applies to one turn and writes nothing. - ModelSelection.advisorModel and SendTurnInput.advisorModel carry the advisor, and isAdvisorModel is the one rule for what a model id is. - The shared Claude driver launches the turn with --advisor <model>. - The driver probes claude --help for --advisor, cached the way the --strict-mcp-config probe is, and refuses the turn with a clear reason when the CLI does not announce the flag, instead of letting the turn die on an unknown option. - The bot's model selection accepts and persists advisorModel, so an advisor is set per bot or per thread and rides every turn. The turn-side tests are in server/drivers/claude.test.ts and the API test is in server/index.test.ts. The rollout note is docs/rollouts/2026-11-26-claude-advisor-per-turn.md and the recipe is docs/verification/claude-advisor.md. Fixes BF-2704
This comment has been minimized.
This comment has been minimized.
|
@kody start-review Head: 89af3bd The change wires the Claude Code advisor model into one turn. SendTurnInput and ModelSelection carry advisorModel, the shared Claude driver launches the turn with --advisor , and a capability probe refuses the turn when the CLI does not announce the flag. No settings file is written, so the owner's global Claude settings stay untouched. Tests: server/drivers/claude.test.ts (the flag reaches the turn, a turn without one has no flag, and a CLI without the flag is refused) and server/index.test.ts (the selection keeps the advisor and refuses a value that is not a model id). The server typecheck is clean. Docs: docs/rollouts/2026-11-26-claude-advisor-per-turn.md and docs/verification/claude-advisor.md. |
|
Automatic approval held Kody's assessment:
|
The lint baseline check counts per rule, so two of the repo's anti-slop rules caught the first pass: an unknown parameter on the advisor check, and a conditional empty object spread where the advisor rides the turn. The advisor rule now lives in its own module (server/advisor-model.ts) with a typed parameter, and the two places that carry the advisor build the object in its own statement. The baseline check passes, and the branch adds no warning of any kind. Refs BF-2704
|
@kody start-review Head: b84a967 This head is the second commit on the branch. The lint baseline check counts per rule, so the repo's anti-slop rules caught the first pass: an unknown parameter on the advisor check, and a conditional empty object spread where the advisor rides the turn. The advisor rule now lives in its own module with a typed parameter, the two places that carry the advisor build the object in its own statement, and the baseline check passes with no new warning of any kind. What the change does: SendTurnInput and ModelSelection carry advisorModel, the shared Claude driver launches the turn with --advisor , and a capability probe refuses the turn when the CLI does not announce the flag. No settings file is written, so the owner's global Claude settings stay untouched. Tests: server/drivers/claude.test.ts (123 pass) and the advisor case in server/index.test.ts. The server typecheck is clean and the lint baseline check passes. |
This comment has been minimized.
This comment has been minimized.
… Turn The four findings on the first two commits are fixed in this third commit. - The affirmative advisor probe now expires with the same bound as every other probe answer, so a CLI downgraded after the first lookup is noticed instead of believed forever. - An advisor change is a model change: the selection check compares the advisor as well, so an advisor-only PATCH while the bot works is refused with the same 409 as a model swap. - The advisor property is omitted when the bot has none, in the turn input and in the active selection, so neither carries an empty advisor key. - A new API test holds the fixture busy and proves that the advisor-only PATCH is refused with 409. Refs BF-2704
|
@kody start-review Head: 49f042c This head answers the four findings from the previous two commits. The affirmative advisor probe now expires like every other probe answer, an advisor change goes through the same busy guard as a model change, and the advisor property is omitted when the bot has none. A new API test holds the fixture busy and proves that the advisor-only PATCH is refused with 409. The server typecheck is clean, the lint baseline check passes, and the Claude driver suite is green at 123 tests. |
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
@kody start-review Head: 49f042c The previous request on this head was skipped with no changed files, so this is a fresh request on the same head. The three commits carry the per-turn advisor model, the lint baseline fix, and the answer to the four findings from the first two commits. Nothing else changed on the branch since that request: the diff against main is the same ten files, and the four threads are answered and resolved. The server typecheck is clean, the lint baseline check passes, and the Claude driver suite is green at 123 tests. |
Fixes BF-2704
Give The Claude Turn An Advisor Model
Refs BF-2704. Adds per-turn advisor model support to Claude turns via the
--advisor <model>launch flag, avoiding the denied/advisorchat command that rewrote the owner's global~/.claude/settings.json. The flag form is per launch and writes nothing, so global Claude settings stay untouched.What changed
ModelSelectionandSendTurnInputcarry optionaladvisorModel, validated by newisAdvisorModelinserver/contracts.ts.--advisor <model>for turns that request one, and probesclaude --helpfor the flag before dispatch, refusing turns on CLIs that do not announce it rather than failing on an unknown option.advisorModelper bot/thread, andstartTurnforwards it to the driver.--advisorin help text, withFAKE_CLAUDE_ADVISOR=offto simulate an older CLI.docs/rollouts/2026-11-26-claude-advisor-per-turn.mdand verification fixturedocs/verification/claude-advisor.md.User-visible / operational impact
{"modelSelection": {"instanceId": "claude", "model": "...", "advisorModel": "..."}}viaPATCH /api/bots/:id; the advisor then rides every turn. Invalid values are rejected with 400.Tests added
server/drivers/claude.test.ts: turn launches with requested--advisor, turn without advisor omits flag, CLI without flag support is refused.server/index.test.ts: saved selection keepsadvisorModeland rejects non-model-id values.--advisorwithout writing settings; these runs are reported, not verified here. A live advisor turn requiring a signed-in Claude seat remains unverified in fixtures.Unresolved risks / review findings
server/index.ts:2578— reported advisor-only PATCH bypass of busy guard mid-turn.server/drivers/claude.ts:2364— reported affirmative advisor probe cached indefinitely, missing CLI downgrade.Summary
Gives the Claude turn an advisor model carried per-turn from the model selection. Validation is centralized in a new
isAdvisorModelIdhelper inserver/advisor-model.ts, replacing the formerisAdvisorModelinserver/contracts.ts.Changes
server/advisor-model.tsto validate an advisor model id as a single launch argument: trimmed 1–64 characters matching/^[a-z0-9][a-z0-9._:/-]*$/i. Updatedserver/drivers/claude.tsand selection validation inserver/index.tsto use it.Operational impact
Claude turns can now run under the selected advisor model when present. No deployment, approval, or runtime verification is reported in the changes provided.
Unresolved risks / review findings
server/index.tsalways carries theadvisorModelkey even when unset, per review. Behavior when unset is unverified.server/index.tsleaksadvisorModel: undefinedinstead of omitting it, per review. Downstream handling of an explicit undefined value is unverified.Testing
No tests added or tests reported as run were found in the changes provided.
Gives the Claude turn an advisor model with safer lifecycle handling. The advisor CLI flag probe is no longer cached forever on
yes, so a later downgraded CLI is re-detected instead of letting the next advisor turn fail on an unknown option. ChangingadvisorModelwhile the bot is working is now treated as a model change and refused with 409. Turns without an advisor now omit the advisor key entirely rather than carrying an empty value.Changes
yesadvisor probe results to the normal expiry, keeping short retry forunknown.advisorModelin busy-bot model-selection change detection.Tests