From 741b843cd0a7d92fa7fe9c2bc4d5f5d373c8f19a Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 29 Oct 2026 09:34:42 +0800 Subject: [PATCH] agent: a stopped distro's Claude Code offers efforts as effort, not models A stopped WSL distro's Claude Code took magpie's model list for every field but model, effort and login, so each tier's effort, the subagents' effort and ultracode offered model ids; picking one was then refused by the running field's Set. The efforts now offer the levels of the model last seen (tierEfforts, as a running distro's do), and ultracode keeps its own options, which read only the last-seen model. Found while giving the WSL card the Claude rows (cybercaius, Discord). Run (mote): go test ./internal/agent -run TestWSLClaudeStopped -count=1, ok. Broken by hand: with the old wsl.go, TestWSLClaudeStoppedEfforts fails (opus_effort offers "relay/glm-4.6"). Not tried: a real stopped distro on the Windows box. --- internal/agent/claude_login_test.go | 34 +++++++++++++++++++++++++++++ internal/agent/wsl.go | 17 +++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/internal/agent/claude_login_test.go b/internal/agent/claude_login_test.go index c85320d22..09488bc64 100644 --- a/internal/agent/claude_login_test.go +++ b/internal/agent/claude_login_test.go @@ -321,3 +321,37 @@ func TestClaudeAtAnOlderGatewayAddress(t *testing.T) { } } } + +// A stopped distro's Claude Code offers a tier's effort, and the +// subagents', the levels of its model as a running one does, not +// magpie's models: picking one of those as an effort is refused (cybercaius). +func TestWSLClaudeStoppedEfforts(t *testing.T) { + root, _ := claudeDistroHome(t, `{}`) + saveDeepseek(t) + d := distro{Name: "Stopped", Root: root, Home: "/home/me", Has: map[string]bool{"dir:.claude": true}, Gateway: "172.20.0.1"} + k := wslKindOf("claude") + a := asleep(wslAgent(k, d), k, d) + cur := map[string]string{"model": "deepseek/pro"} + for _, key := range []string{"opus_effort", "sonnet_effort", "haiku_effort", "subagent_effort"} { + f := a.Field(key) + if f == nil { + t.Fatalf("no %s", key) + } + for _, o := range f.Options(cur) { + if !contains(provider.MemberEfforts, o.Value) { + t.Fatalf("%s offers %q, not an effort: %v", key, o.Value, f.Options(cur)) + } + } + } + if f := a.Field("ultracode"); f != nil { + for _, o := range f.Options(cur) { + if o.Value != "on" { + t.Fatalf("ultracode offers %q", o.Value) + } + } + } + // a tier still offers magpie's models + if len(a.Field("opus").Options(cur)) == 0 { + t.Fatal("opus offers no model") + } +} diff --git a/internal/agent/wsl.go b/internal/agent/wsl.go index f060b89f8..6411056d0 100644 --- a/internal/agent/wsl.go +++ b/internal/agent/wsl.go @@ -2,6 +2,7 @@ package agent import ( "bufio" + "cmp" "context" "encoding/json" "fmt" @@ -365,7 +366,8 @@ var wslKinds = []wslKind{ return func(cur map[string]string) []Option { return append(group("Claude Code", claudeOwn(cur["model"], nil, catalog.Provider("anthropic"))), claudeViaMagpie(false)...) } - case "effort": + case "effort", "ultracode": + // their own options read only what was last seen return nil case "login": // its sign-in, while the model last seen is magpie's @@ -376,7 +378,18 @@ var wslKinds = []wslKind{ return claudeSignIns() } } - // a tier: magpie's models while the model last seen is one + // a tier's effort or the subagents': the levels of the model it + // was last seen on, as when running, not a model to pick + if tier, ok := strings.CutSuffix(key, "_effort"); ok { + return func(cur map[string]string) []Option { + if !isMagpie(cur["model"]) { + return nil + } + return static(tierEfforts(cmp.Or(cur[tier], cur["model"]))...) + } + } + // a tier, the subagents or auto mode: magpie's models while the + // model last seen is one return func(cur map[string]string) []Option { if !isMagpie(cur["model"]) { return nil