The model option's currentValue names the model in use, not 'default' or an alias #12
No reviewers
Labels
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/claudeacp!12
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/claudeacp-9lf"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was wrong
The model option's current value (and its values) were entries of claude's list of models:
default,opus,sonnet. A session pinned to--model claude-opus-5-5showeddefault, and so did one with no--model. Claude 2.1.322 answersinitializewithcurrent_model: nullwhatever--modelsays (probed), and listsdefaultandopusas one model,claude-opus-5-5, so the agent had only the alias to show.The first commit is a test that fails on main and shows this; the second is the fix.
What changes
The option's values are the list's
resolvedModel(the alias where claude names none), one value for entries that share an id. The current value is the id of the model the session runs on:--model/_meta.claudeCode.options.modelnames (an alias is read as the id it resolves to; an id the list doesn't name, such as--model claude-opus-4-1, is kept as it is and keeps the effort and fast options of the listed model of its kind), else the id the default resolves to;system/init, a refusal's fallback): the new model's id.What a client must send
Reading changes, sending does not. A client that keys on the old values (
default,opus,sonnet) has to key on ids; the changelog entry is marked Breaking for that. To set the option a client sends one of its values, as before; an id or an alias of claude's list is still accepted, and claude is told the alias as before. Setting the id a session is pinned to is a no-op; setting the listed model of its kind switches to it.Behaviour to know: a
--modelthat matches no model of the list at all (neither by id, alias nor by containing an alias) now shows as given, with no effort or fast option, as a fallback model already did; before it showeddefaultwith the default's options.Checks
go vet,go test ./...,golangci-lint run(v2): clean. New:TestModelOptionNamesModel,TestModelOptionSet,TestModelOptionFollowsClaude,TestModelOptionPinnedID, against the list claude 2.1.322 really sends. Existing option tests updated to ids. README (config options) and CHANGELOG updated. The rexcity half of the feature is rexcity-49in3.Bead: claudeacp-9lf
The option's values were the entries of claude's list of models ("default", "opus", "sonnet"), so a session pinned to --model claude-opus-5-5, or with no --model at all, showed "default"; claude 2.1.322 answers initialize with current_model null whatever --model says, so the agent had only the list to go by, and lists the default and "opus" as one model, claude-opus-5-5. Now the option's values are the entries' resolvedModel (the alias where claude names none), one value for entries that share an id, and the current value is the id of the model the session runs on: - at start, the id --model or _meta.claudeCode.options.model names: an alias is read as the id it resolves to; an id the list doesn't name is kept as it is (config.pinned when it only loosely names a listed model, so the option keeps that model's effort and fast mode), else the model the default resolves to; - after a switch of the client's, claude's own (system/init, a refusal's fallback) or a /model, the new model's id. What a client sends doesn't change: setModel still looks a value up by id, alias or loosely, and tells claude the alias. Setting the id a session is pinned to is a no-op; setting the listed model of its kind switches. Validation: TestModelOption* (new; the first commit shows them failing on main), the existing option tests updated to ids, go vet, golangci-lint v2, and claude 2.1.322's real initialize answer for the list the tests use.Review of
c875d0169ffor claudeacp-9lf. Checks of the head: success.Verdict
pass
Findings
--model claude-opus-4-1, whichTestModelOptionNamesModelitself expects asclaude-opus-4-1[claude-opus-5-5 …]) or for a refusal's fallback model. The current value is outside the values there, as it already was for a fallback before this change. Reword the comment to say so. A client that renders a select only from its values will show such a session without a selected entry, which is worth one clause in the README.modelSwitched): the news is now judged on the shown value only. A session pinned toclaude-opus-4-1(model=opus,pinned=claude-opus-4-1) that gets a PostModelSwitch toclaude-opus-4-1ends withc.model="claude-opus-4-1",pinned="":modelInfo()is nil, so the effort and fast options are gone. The function returns false, and the client is not told. That switch is unlikely in practice (a fallback goes to another model), so this does not block. Comparingc.modelas well as the shown value would cover it.Verified
main(there is no REVIEW.md, AGENTS.md or CLAUDE.md) and the whole diff (8 files, +222 −46). The change does what the bead asks:--model, the current value is the id--modelnames (an alias read as itsresolvedModel, an unlisted id kept as given);--model, it is the id the default resolves to;system/init, PostModelSwitch), it is the new model's id.e2a734d(the test commit alone),go test -run TestModelOption ./claudeacpfails on all three new tests (default[default opus fable sonnet haiku]whereclaude-opus-5-5[…]is wanted, and so on). At the head they pass.setModelstill accepts an option value, an id or an alias and sends claude the alias (TestModelOptionSet,TestModelOptionPinnedID, the updatedTestSetConfigOption). I tracedlookupfor--model claude-opus-5-5: it maps to thedefaultentry byresolvedModeland showsclaude-opus-5-5, which is the Worker's case from the bead.origin/main(1d1bd8d): clean, a fast-forward.go build ./...,go vet ./...,go test -race -shuffle=on ./...all ok.golangci-lintv2.15.0 (built from the module cache): 0 issues. The changelog checker, built from mikluko/changelog at 087d7e8 (v2.1.0, the commit the workflow pins) and run with the action's defaults and-fragments= -base=main:valid=true.govulncheck, which needs the vulnerability database over the network. The change adds no dependency.currentModelreturnsc.model, notpinned).