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.
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
+15
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user