agent: a Claude Code tier set to a model keeps it when the main model moves onto that model, not "Same as main model" (#2257, luokinging)
A Fable tier set to GPT-6.1 Sol read "Same as main model" once the main
model was switched to Sol, and the next main-model move took it with it.
On a move of the main model, a tier equal to the new main model was kept
as its own only when it equalled what it would follow there. Fable follows
nothing on a model that is no Fable, and haiku follows a Claude model on
its Haiku, so neither was marked: Get then hid the tier as following, and
the next move rewrote it. The new main model itself now counts as the
tier's own model too, for every tier and both routes (magpie and Claude
Code's /model). GUI, TUI and CLI all read the same Field.
A user already caught by it sees "Same as main model" and sets the tier
again once; that state can't be told from a tier that follows.
TestClaudeFableTierOnClaude modelled 0.1.1229's wiring with fable=Sol
written before the main model moved onto Sol, which is this issue's own
case; its fixture now writes it after, as 0.1.1229 did.
Run:
- TestClaudeOwnTierOnTheNewMainModelStays (every tier, two own models,
magpie and /model): on the old code fable fails for both models and
routes, and haiku given Opus fails ("haiku reads \"\""); passes now.
- CLI in a sandbox HOME/CLAUDE_CONFIG_DIR, old and new binary: main ->
k2.8, fable -> Sol, main -> Sol, main -> GLM. Old: fable gone after the
move onto Sol, no ANTHROPIC_DEFAULT_FABLE_MODEL after GLM. New: fable
Sol after both, env ANTHROPIC_DEFAULT_FABLE_MODEL=oa/gpt-6.1-sol.
- go test -tags nogui ./internal/agent/ ./internal/tui/ ./internal/cli/:
ok. gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: clean.
Not tried: the GUI by hand (no asset changed; it reads the same Field).
This commit is contained in:
@@ -61,7 +61,7 @@ something else shows up as drift.
|
||||
- A config that starts with a UTF-8 byte order mark (a Windows `settings.json` or `config.toml` saved by PowerShell, Notepad or a channel switcher, #1534) is read without it (`edit.Read`), and a write keeps it (`keepBOM` in `WriteAtomic`): the user's file keeps the encoding it was saved in. That covers every format `internal/edit` writes (JSON/JSONC and its arrays, TOML, YAML, env); Codex reads a TOML file through a BOM too, so magpie no longer refuses one. A file read some other way trims it with `edit.TrimBOM` (the Claude Code and CC Switch imports). A line an edit takes out of a CRLF file goes with its `\r\n`.
|
||||
- Codex signed in to ChatGPT stays beside its sign-in (`openai_base_url`) unless the user picks magpie API. magpie becomes its provider only while the Codex app holds the active account, which it sends nothing for: `/wham/usage` says it isn't allowed, and it has no credits and isn't a workspace still within its overage (`codexHeld`, read by `provider.CodexUsedUp`). Where the app goes by what usage can't show (an experiment's gate, a reserve, a Team plan's overage under the reserve experiment), it counts as held: a wrong move costs ChatGPT extras, a missed one every turn. A saved reading kept through a failed read stops saying held once its used-up window has started again; a hold with no window used up stays till a fresh read. The app then loses its ChatGPT state (durable threads, remote control), so a window at 100% alone, which credits get past, doesn't move it (`codex.out` marks the move, and Sync undoes it once the account has room).
|
||||
- Moving a field from one of magpie's models to another (the agent's own picker) is not drift. Moving it off magpie is.
|
||||
- A field that follows another while empty (`Follows`: Claude Code's tiers and subagents on its main model) is read by `Drift` as on that field's model. The main model moved, in Claude Code's own `/model`, onto the model magpie had set a tier to is not drift (#1050).
|
||||
- A field that follows another while empty (`Follows`: Claude Code's tiers and subagents on its main model) is read by `Drift` as on that field's model. The main model moved, in Claude Code's own `/model`, onto the model magpie had set a tier to is not drift (#1050). The tier keeps that model as its own through the move and the next one (`tier_own` in the stash), whatever it would follow on the new main model: fable, which follows no model that is no Fable, and haiku, which follows a Claude model on its Haiku, read as following and lost their model on the next move (#2257).
|
||||
- A Claude Code tier or its subagents given a model of their own keep it when the main model moves onto that model and on again (`ownKey` in `claudeIn`), whether the main model is picked in magpie or in Claude Code's `/model`. Same as model, picked for them, has them follow again.
|
||||
- While this machine's Claude Desktop is on magpie, Claude Code's shared settings get `CLAUDE_CODE_DISABLE_EXPLORE_INHERIT_CAP="1"` (`writeExplore` in `claudeIn`, [`claude.go`](../../internal/agent/claude.go)). Claude Code 2.1.295's Explore inherit cap can otherwise replace Desktop's `mythos-magpie` compatibility alias with Opus. This disables that cap, not the model choices of all subagents. It applies with Desktop alone or beside a connected Claude Code, including model picks and Sync; WSL twins do not get it. A user's existing value, including an empty string, stays. The stash (`claude.explore_inherit_cap`) marks only magpie's value: taking Claude Code off magpie leaves it while Desktop is on, and taking Desktop off removes it only if the user has not changed it. Since the settings file is shared, other Claude Code sessions reading it see the flag while Desktop is connected too.
|
||||
- Claude Code's tier and subagent models the user had set for their own endpoint (`claudeOwnEnv`) are stashed with that endpoint and token when magpie is wired in, and come back with them when magpie steps out, by Disconnect or by Claude Code's own model (#1050).
|
||||
|
||||
@@ -1271,9 +1271,14 @@ func claudeIn(at place) *Agent {
|
||||
// ones given a model of their own keep it, the one the new
|
||||
// main model is too, so it stays when the main model moves
|
||||
// on again (#1050: a sonnet tier on Sonnet went to Opus with
|
||||
// the main model's next move)
|
||||
// the main model's next move). The new main model itself is
|
||||
// one too where the tier would follow another or none: a fable
|
||||
// tier given GPT-6.1 Sol, the main model moved onto it, read as
|
||||
// following and was lost on the next move (#2257), as was a
|
||||
// haiku tier given Opus (it follows Opus on its Haiku).
|
||||
same := func(t, m string) bool {
|
||||
return strings.TrimSuffix(m, "[1m]") == strings.TrimSuffix(follow(t, v), "[1m]")
|
||||
m = strings.TrimSuffix(m, "[1m]")
|
||||
return m == strings.TrimSuffix(v, "[1m]") || m == strings.TrimSuffix(follow(t, v), "[1m]")
|
||||
}
|
||||
if !routed() {
|
||||
forget(ownKey("subagent"))
|
||||
|
||||
@@ -95,10 +95,10 @@ func TestClaudeFableTierOnClaude(t *testing.T) {
|
||||
}
|
||||
}
|
||||
// the reporter's settings.json, the fable tier on Sol, from 0.1.1229:
|
||||
// Follow takes it out
|
||||
if err := edit.SetJSON(path, edit.KV{Path: "env.ANTHROPIC_DEFAULT_FABLE_MODEL", Value: "cx/gpt-6.1-sol"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Follow takes it out. 0.1.1229 wrote it there following the main
|
||||
// model on Sol; a fable tier on Sol before the main model moved onto
|
||||
// it is one given Sol, which stays (#2257,
|
||||
// TestClaudeOwnTierOnTheNewMainModelStays)
|
||||
if err := a.Field("model").Set("cx/gpt-6.1-sol"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -177,3 +177,69 @@ func TestClaudeOwnTierStaysThroughTheMainModel(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Every tier given a model of its own keeps it when the main model moves
|
||||
// onto that model and on again, picked in magpie or in Claude Code's
|
||||
// /model, whatever the tier would follow there (#2257, luokinging): a
|
||||
// fable tier given GPT-6.1 Sol, with the main model moved from K2.8
|
||||
// Preview onto GPT-6.1 Sol, read as "Same as main model", since fable
|
||||
// follows no model that is no Fable, and the main model's next move
|
||||
// took it off. A haiku tier given Opus, the main model moved onto Opus,
|
||||
// was lost the same way (haiku follows a Claude model on its Haiku).
|
||||
func TestClaudeOwnTierOnTheNewMainModelStays(t *testing.T) {
|
||||
for _, own := range []string{"oa/gpt-6.1-sol", "anth/claude-opus-5-5"} {
|
||||
for _, tier := range claudeTiers {
|
||||
for _, via := range []string{"magpie", "/model"} {
|
||||
t.Run(own+"/"+tier+"/"+via, func(t *testing.T) {
|
||||
home, _ := codexHome(t, "", "")
|
||||
a := claude(home)
|
||||
if err := provider.Save(provider.Provider{ID: "anth", Name: "Anthropic", Chat: "https://api.anthropic.com/v1", Key: "k",
|
||||
Models: []string{"claude-opus-5-5", "claude-haiku-4-5"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := provider.Save(provider.Provider{ID: "oa", Name: "OA", Chat: "https://oa.example/v1", Key: "k",
|
||||
Models: []string{"gpt-6.1-sol", "k2.8-preview", "glm-6"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
path := filepath.Join(home, ".claude", "settings.json")
|
||||
bare := func(s string) string { return strings.TrimSuffix(s, "[1m]") }
|
||||
main := func(m string) {
|
||||
t.Helper()
|
||||
if via == "magpie" {
|
||||
if err := a.Apply("model", m); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
if err := edit.SetJSON(path, edit.KV{Path: "model", Value: m}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Follow(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := a.Apply("model", "oa/k2.8-preview"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Apply(tier, own); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if v := a.Values(); bare(v[tier]) != own {
|
||||
t.Fatalf("the tier given %s reads %q", own, v[tier])
|
||||
}
|
||||
main(own)
|
||||
if v := a.Values(); bare(v[tier]) != own {
|
||||
t.Fatalf("main model moved onto the tier's model: %s reads %q, not its own %s\n%s", tier, v[tier], own, readFile(path))
|
||||
}
|
||||
main("oa/glm-6")
|
||||
if m, _ := edit.GetJSON(path, "env."+tierEnv(tier)); bare(m) != own {
|
||||
t.Fatalf("main model moved on again: %s is %q, not its own %s\n%s", tier, m, own, readFile(path))
|
||||
}
|
||||
if v := a.Values(); bare(v[tier]) != own {
|
||||
t.Fatalf("main model moved on again: %s reads %q", tier, v[tier])
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user