Repository navigation
fix(claude): stop pinning the model in settings.local.json - #40326
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix removes the cause: the seed no longer writes the pin that Claude Code reads as a family fold. The retry and fallback items only keep the substitution behaviour working now that the pin is gone. What this change shipsInventory (8 items) — 8 justifiedIntent: a Claude Code harness user with a pinned model can see and pick every served model, Opus 5.5 included, and an in-chat
[FIRST-PRINCIPLES-REVIEWED] 079d382 Description read[DESCRIPTION-READ] 3193649f9dd5b91b5528a02dc42b58eec593e8130deeba50f3ee7f85bb459d54 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The fix removes the duplicate pin channel at its source, and the live Notes
[DESIGN-REVIEWED] 079d382 Description read[DESCRIPTION-READ] 91d0d9546697d814cd755f877736dcd3774301829adcb1c97e81ea7978b7ce22 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
5e72eab to
bac3368
Compare
|
span=69c367528387
|
|
span=9131ee4c107f
|
bac3368 to
83b6299
Compare
|
span=9131ee4c107f
|
|
span=d2197c721950
|
Claude Code reads a settings `model` key as a pin and folds that model's whole family into one alias row. Crew wrote a session's pinned model there, so a session pinned to Opus 4.8 was offered one `opus` row and no Opus 5 or Opus 5.5, Crew cached that short list as what the account is served, and an in-chat /model to the pinned id did nothing. The pin already reaches the session over session/set_config_option (_apply_startup_model), which narrows nothing, so the seed no longer writes it. The one model the seed still writes is the substitute a restricted-model advisory names. A sibling sharing a seed checks the model it runs against the seed's list. Closes #37240
83b6299 to
079d382
Compare
Code change approver deep review: ApproveApproved on commit Tier: 2, cleared by a deep review: the decider's hold. A deep review by the code change approver, not by a person · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved by the code change approver's deep review, not by a person.
Approved on head 079d382. I read the seed, both retry paths and the tests. A pinned session's settings.local.json no longer carries model at a normal start (src/kiro_crew/acp/client_claude_seed.py:371-377), and the pin still reaches the session through session/set_config_option on the per-chat client and the shared runtime. Both retry loops are bounded at two re-sends. PR Readiness is green on this head, including the backend test shards and the new-test stability runs on Ubuntu and Windows. I did not run anything myself.
Done well: test_a_pinned_model_never_reaches_the_settings_file asserts the key is absent with and without another source's availableModels, and the per-chat retry tests assert the exact sequence of seeds sent.
Security: the change touches which sibling sessions may share another session's settings seed. I checked _share_sibling_settings_seed (src/kiro_crew/acp/client_claude_seed.py:227-233). A share still requires every key other than availableModels and model to be equal, so permissions.defaultMode, deny rules and ask rules must match exactly. Only the model comparison changed. An unpinned sibling is still refused a seed that names a model. The model name taken from the backend advisory is still redacted twice before it is logged. No permission, sandbox or approval rule is widened.
Optional:
- On an install where policy refuses the user's inherited default, the retry writes the pin back as
model(src/kiro_crew/acp/client_claude_session.py:1075,src/kiro_crew/acp/client_claude_seed.py:375-377). The picker there stays as it is on main, so this is not a regression, but the fix does not reach those installs. Consider naming that case under "Not a goal", changing the spec's "never written asmodel" to "never written at a normal start", and correcting the Backwards compatibility sentence that says the substitution retry is unchanged. src/kiro_crew/acp/client_claude_session.py:1044-1045returns the failed response when the chosen model equals the adopted one, even if the backend now offers a different model. The shared runtime falls back to the offered model in the same state (src/kiro_crew/acp/harness/claude.py:923-928). How often this state occurs is unknown.- Three texts still describe the removed write: the
Concern.MODELruling atsrc/kiro_crew/providers/mirrors/claude_code.py:101-105, item 3 of the_write_claude_local_settingsdocstring (src/kiro_crew/acp/client_claude_seed.py:420), and the comment atsrc/kiro_crew/acp/harness/claude.py:345.
Tier: 2, cleared by a deep review: the decider's hold.
Criteria: no merge conflict, no owner block, no change request, the default branch, no security-sensitive path, no design document to agree on, the readiness status, the review lanes, the P0 history, the linked issues' tier, the review lessons, no concern label, the file count, a safe change category, not its own change, the decider.
Design documents ride along with the code (docs/system-specs/modules/claude-code-provider.md): they were not reviewed as a design, and a person who changes what they decide should ask for that review.
To overrule it, request changes or dismiss this review.
|
@buluoray a review finding on a later PR points at code this PR added. I checked it on main Trigger. A per-chat Claude client adopted model A in an earlier start ( Per-chat path. KiroCrew/src/kiro_crew/acp/client_claude_session.py Lines 1043 to 1045 in f80ac95 model = self._substitution_retry_model(substitute)
if model == getattr(self, "_adopted_substitute_model", None):
return session_respThe fallback to the second advisory at L1046-L1053 only runs when the pin was first named in this same call, so it does not cover a pin adopted in an earlier start. Shared-harness twin. The same case falls back once to B: KiroCrew/src/kiro_crew/acp/harness/claude.py Lines 923 to 928 in f80ac95 Verdict: confirmed. A local stub run against main shows it. Source: the GPT 6.1 Review comment on #40392 (adjudication upheld it as MEDIUM): #40392 (comment) A likely fix: give the per-chat guard the twin's branch, so an adopted model that is refused again falls back once to the offered substitute. AI-assisted, posted by Kiro Crew Captain |
Claude Code reads a settings `model` key as a pin and folds that model's whole family into one alias row. Crew wrote a session's pinned model there, so a session pinned to Opus 4.8 was offered one `opus` row and no Opus 5 or Opus 5.5, Crew cached that short list as what the account is served, and an in-chat /model to the pinned id did nothing. The pin already reaches the session over session/set_config_option (_apply_startup_model), which narrows nothing, so the seed no longer writes it. The one model the seed still writes is the substitute a restricted-model advisory names. A sibling sharing a seed checks the model it runs against the seed's list. Closes #37240 (cherry picked from commit 6936cc9)
Problem / Motivation
Goal: On the Claude Code harness, a Bot or chat with a pinned model sees every model the account serves in the picker, Opus 5 and Opus 5.5 included, and an in-chat
/modelswitch sticks.A user on the Claude Code harness reported that the model picker has no Opus 5.5 row, and that the Opus 4.6 rows carry an Opus 5.5 description. Standalone Claude Code on the same host lists Opus 5.5.
Why it matters
Anyone on the Claude Code harness with a Bot or chat pinned to a model loses the newer models of that model's family from the picker, so they cannot pick the newest Opus from Kiro Crew at all. The short list is then cached as what the account is served, so every later picker shows it too.
Not a goal
~/.claude/settings.jsonpins a model, Claude Code itself folds that family the same way. Kiro Crew does not edit that file.What changed (motivation → approach → change)
Claude Code reads a
modelkey in a settings file as a pin and folds that model's whole family into one alias row. Kiro Crew wrote the session's pinned model asmodelinto<work dir>/.claude/settings.local.json. So a session pinned to Opus 4.8 was offered oneopusrow and no Opus 5 or Opus 5.5, Kiro Crew cached that short list as what the account is served, and/model <the pinned id>did nothing because the file kept re-pinning it.The pin already reaches the session a second way:
_apply_startup_modelpushes it oversession/set_config_option, which narrows nothing. So the settings seed (acp/client_claude_seed.py) no longer writes the session's pin. It still writesavailableModelswhen another settings source defines one, and it still writesmodelfor the one case that needs it: the substitute model the backend names in a restricted-model advisory, warm cache or cold.With no pin in the seed,
session/newstarts on the user's own default model. When a policy refuses that default ("Model X is restricted ... Using Y instead"), the one retry names the session's pin if the backend advertised it, and the substitute otherwise (_substitution_retry_model). If the backend refuses the pin too, the start falls back once to the model it offers, as before, since a session on that model beats one that never starts. Both the per-chat client and the shared runtime use this, so one start re-sendssession/newat most twice. The retry's model also rides the envelope's flag tier (options.settings.model), so a seed another session shares, which is not rewritten, cannot hide it.A sibling session that shares another session's seed now checks the model it runs (its substitute, else its pin) against that seed's list, since the seed no longer names a pin. An unpinned sibling can now share a pinned owner's seed: the seed no longer starts it on the owner's model.
The Claude Code provider spec, the field table in
src/kiro_crew/docs/agent-spec-fields.mdand the mirror docstring say the pin is pushed live and never written.Backwards compatibility
Compatible: a pinned session still runs its pin, now set only over
session/set_config_option; an unpinned session, the substitution retry and the permission keys of the seed are unchanged.Removes nothing: the seed's
modelkey was a duplicate channel for a value the live push already delivers; the substitute case keeps it.Tests
test_acp_session_mcp.py::TestLocalSettingsSeed::test_a_pinned_model_never_reaches_the_settings_file(new, both with and without another source'savailableModels): a pinned session's seed has nomodelkey, and the list still names the pin.test_acp_seed_provenance_sibling_sharing.py: an unpinned sibling shares a pinned owner's seed; an unpinned sibling is refused a seed carrying a substitute; a sibling whose pin the seed does not list is still refused.test_acp_client_model_substitution.pyandtest_claude_shared_runtime.py: on a warm cache a refused inherited default keeps a served pin (substitute equal to the pin or not), a pin the backend does not advertise adopts the substitute, a refused pin falls back once to the offered model, a start never re-sends more than twice, and a sibling sharing the seed carries the retry model on the envelope.modelkey now assert its absence; the substitution re-seed tests set the adopted substitute, as both real callers do.-n 4 --dist loadand once serially (-n0), green each time.Proof: PROVEN test/test_acp_client_model_substitution.py::TestSubstitutionFollow::test_a_served_pin_survives_a_refused_inherited_default[other_model], test/test_acp_client_model_substitution.py::TestSubstitutionFollow::test_a_served_pin_survives_a_refused_inherited_default[the_pin], test/test_acp_client_model_substitution.py::TestSubstitutionFollow::test_a_pin_not_served_adopts_the_substitute, test/test_acp_client_model_substitution.py::TestSubstitutionFollow::test_a_refused_pin_falls_back_once_to_the_offered_model, test/test_acp_client_model_substitution.py::TestSubstitutionFollow::test_a_start_never_retries_more_than_twice (head 079d382)
Manual verification
Drove the Claude Agent SDK that
@agentclientprotocol/claude-agent-acp0.99.1 installs (@anthropic-ai/claude-agent-sdk0.3.312), with a freshHOMEandCLAUDE_CONFIG_DIR,CLAUDE_CODE_USE_BEDROCK=1and no credentials (supportedModels()answers offline),settingSources: ["user", "project", "local"]and a project.claude/settings.local.json:settings.local.jsonsupportedModels()lists{}(the head's seed for a pinned session){"model": "us.anthropic.claude-opus-4-8"}(main's seed)opusrow: "Opus 4.8 · Custom Opus model"{"model": "global.anthropic.claude-opus-4-6-v1[1m]"}opusrow plus the pinned id, both "Opus 4.6 (1M context)"Real-machine verification
Machine: own Linux computer, Amazon Linux 2023, x86_64, 32 vCPU / 247 GB.
Before (main 0a2e92e): a pinned session's seed is
{"model": "<pin>", ...}, and the SDK probe above with that file lists oneopusrow and no Opus 5 or Opus 5.5.After (head 079d382):
python -m pytest -n0 test/test_acp_session_mcp.py -k pinned_model_neverpasses (it failed on main withassert 'model' not in {...}), the seed carries nomodelkey, and the SDK probe with that file lists every Opus row.Cleanup: own computer; the probe's scratch
HOMEand project folder deleted.Related Issues
Closes #37240
Sibling sweep
Swept: git grep -nE '["model"] *=|"model": *(self|model|pin|resolved)' -- src/kiro_crew/acp src/kiro_crew/providers
Sibling: src/kiro_crew/acp/client_claude_session.py -- not affected -- its inline settings beside a project-owned file are parsed from the same rendered payload
Sibling: src/kiro_crew/acp/harness/claude.py -- not affected -- the shared runtime seeds through the same
_write_claude_local_settingsPattern harvest
Not generalizable: the defect is one adapter's reading of one settings key; no other harness seed writes a model pin into a file the harness re-reads.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits