dsh: a thinking level set on magpie's route by hand is what its sessions start on
ming_li52905 on X set a level per route in dsh's config:
providers:
magpie-responses:
reasoning: high
and magpie "overwrote" it. magpie never dropped the key. llm-pi-ai starts
a route's models on profile.reasoning only when the session names no
effort (options.reasoningEffort ?? profile.reasoning, dsh-llm-pi-ai
0.2.2-rc.3). agent-default-model's reasoningEffort, which magpie's
thinking setting writes, is the effort every new session names, so the
user's level never applied.
Now the route's own level wins over magpie's one default:
- A start magpie writes on such a route (switch, set) carries no effort
of magpie's.
- A sync or round takes out an effort magpie wrote there before
(dshStartYields). magpie keeps what it last wrote into each list's
start (dsh-effort:<file> in the stash), so an effort dsh saved itself
(a composer pick, #1392) is the user's and stays. When the home layer
mirrors a profile's start, it takes that profile's record too.
- Thinking reads the route's level when the start names none, and
setting it writes the route's reasoning wherever it is set: each
profile, the home layer, settings.yaml. It writes no reasoningEffort.
- A route without a level still gets magpie's effort, as before.
Tests: TestDshRouteLevelOfTheUsersOwn (sync, round stability, a switch
away and back, thinking set, dsh's own saved effort kept),
TestDshRouteLevelInTheHomeLayer, TestDshRouteWithoutLevelTakesMagpiesEffort.
Run:
- The three tests at the old dsh.go: red (start keeps "medium" over
high, thinking reads medium, thinking low leaves the level).
- Broken by hand, each red: the record check ignored (dsh's own effort
stripped); Get not reading the level; the round's dshStartYields
removed (both level tests red).
- go test -count=1 ./internal/agent on mote: ok (237.9s).
- GOOS=linux go vet -tags nogui and GOOS=windows go vet of
./internal/agent on mote: ok. gofmt -l: clean.
Not run: the full ./... suite. mote's suite lock had four full runs
queued ahead of it. The change is internal/agent only.
Not tried: a real dsh. The precedence comes from dsh-llm-pi-ai
0.2.2-rc.3's source, not from a session.
Risk: a start written before this release has no record. If its effort
differs from a route level the user set, it is taken for magpie's and
removed once, even if dsh had saved it.
This commit is contained in:
+193
-4
@@ -610,6 +610,10 @@ func dshMirrorHome(dir string, models []catalog.Model, gw string, start bool) er
|
||||
stash(map[string]string{dshStashKey(home, "agent-default-model"): strings.Join(items[i].lines, "\n")})
|
||||
}
|
||||
items[i] = dshItem{id: "agent-default-model", magpie: true, lines: append([]string{}, web[j].lines...)}
|
||||
// what magpie wrote there is what it wrote in the profile
|
||||
if was := unstashPeek(dshEffortKey(files[0])); was != "" {
|
||||
dshEffortWrote(home, strings.TrimPrefix(was, dshNoEffort))
|
||||
}
|
||||
case dshOurs(items[i]):
|
||||
// magpie's start gone from the profiles: the user's back, or none
|
||||
if old := unstash(dshStashKey(home, "agent-default-model")); old != "" {
|
||||
@@ -1786,10 +1790,14 @@ func dshSetFile(path, v string, modern bool, models []catalog.Model, gw string)
|
||||
if items, err = dshPutRoute(items, true, models, gw); err != nil {
|
||||
return err
|
||||
}
|
||||
if !contains(dshLevels(dshListFor(path), ref), effort) {
|
||||
route := dshRouteFor(ref, models)
|
||||
// a route with a level of the user's own starts on it, not on
|
||||
// magpie's effort carried over (dshRouteLevel)
|
||||
if !contains(dshLevels(dshListFor(path), ref), effort) || dshLevelFor(path, items, route) != "" {
|
||||
effort = ""
|
||||
}
|
||||
put("agent-default-model", dshDefaultLines(dshRouteFor(ref, models), ref, effort))
|
||||
put("agent-default-model", dshDefaultLines(route, ref, effort))
|
||||
dshEffortWrote(path, effort)
|
||||
items = dshPutSearch(items, dshProfileHome(path), dshSearchModel(ref), gw)
|
||||
case modern:
|
||||
drop("llm-deepseek")
|
||||
@@ -1801,6 +1809,7 @@ func dshSetFile(path, v string, modern bool, models []catalog.Model, gw string)
|
||||
effort = ""
|
||||
}
|
||||
put("agent-default-model", dshDefaultLines("deepseek-official", v, effort))
|
||||
dshEffortWrote(path, effort)
|
||||
case viaGateway:
|
||||
put("llm-deepseek", dshProviderLines(effort, models, gw))
|
||||
put("agent-loop", dshLoopLines(ref))
|
||||
@@ -2571,6 +2580,14 @@ func dshRouteAgainSaid(f string, models []catalog.Model, gw string) (string, err
|
||||
if dshJoin(items) != before {
|
||||
what = "route"
|
||||
}
|
||||
// magpie's effort yields to a level the user set on the route since
|
||||
if moved := dshJoin(items); what == "search" {
|
||||
if items = dshStartYields(f, items); dshJoin(items) != moved {
|
||||
what = "level"
|
||||
}
|
||||
} else {
|
||||
items = dshStartYields(f, items)
|
||||
}
|
||||
if dshProfileList(f) {
|
||||
items = dshSearchAgain(items, dshProfileHome(f), gw)
|
||||
}
|
||||
@@ -2916,6 +2933,8 @@ func dshWiredWith(dir string, files []string, models []catalog.Model) string {
|
||||
case "search":
|
||||
// agent-default-model left as dsh saved it (#5222)
|
||||
log.Printf("dsh's web search in %s follows the model it starts on now", f)
|
||||
case "level":
|
||||
log.Printf("dsh's start in %s goes by its route's own thinking level", f)
|
||||
}
|
||||
}
|
||||
// deepseek-acp's, which dsh 0.2 takes away at each start
|
||||
@@ -3079,6 +3098,158 @@ func dshEffortOf(items []dshItem) string {
|
||||
return dshEffortIn(items)
|
||||
}
|
||||
|
||||
// A route of magpie's can carry a thinking level of the user's own,
|
||||
// providers.<route>.reasoning in the llm-pi-ai entry, set by hand (magpie
|
||||
// never writes it). llm-pi-ai starts each model of the route on it unless
|
||||
// the session names an effort (options.reasoningEffort ?? profile.reasoning,
|
||||
// dsh-llm-pi-ai 0.2.2), and agent-default-model's reasoningEffort is the
|
||||
// effort every new session names. magpie's thinking setting is one default
|
||||
// for every route, and it wrote that reasoningEffort, so a level set on a
|
||||
// route never applied: the user's per-route level read as overwritten
|
||||
// (ming_li52905 on X). Now the route's own level wins over magpie's
|
||||
// default: a start magpie writes on such a route has no effort of magpie's,
|
||||
// one magpie wrote there before goes (dshStartYields), and the thinking
|
||||
// setting reads and sets the route's level. An effort dsh saved into the
|
||||
// entry (a pick in its composer, #1392) is the user's and stays: magpie
|
||||
// keeps what it last wrote into each list's start (dshEffortKey) to tell
|
||||
// the two apart.
|
||||
|
||||
// dshRouteLevel is the reasoning level set on magpie's route in a patch
|
||||
// list's llm-pi-ai entry, "" for none.
|
||||
func dshRouteLevel(items []dshItem, route string) string {
|
||||
if v := yamlKey(dshRoutesIn(items)[route], "reasoning"); v != nil && v.Kind == yaml.ScalarNode {
|
||||
return v.Value
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// dshLevelFor is the level route has where dsh reads patch list f, whose
|
||||
// entries are items: a profile's over the home layer; for the home layer,
|
||||
// its own llm-pi-ai entry, else the first profile's. A config.yaml from
|
||||
// before profiles has no routes.
|
||||
func dshLevelFor(f string, items []dshItem, route string) string {
|
||||
if !isDshRoute(route) {
|
||||
return ""
|
||||
}
|
||||
dir := dirOf(f)
|
||||
if dshProfileList(f) {
|
||||
return dshRouteLevel(dshOver(dir, items), route)
|
||||
}
|
||||
if f != dshHomePatch(dir) {
|
||||
return ""
|
||||
}
|
||||
if dshConfigIndex(items, dshPiRow) >= 0 {
|
||||
return dshRouteLevel(items, route)
|
||||
}
|
||||
files := dshProfiles(dir)
|
||||
if len(files) == 0 {
|
||||
return ""
|
||||
}
|
||||
_, web, err := dshLook(files[0])
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return dshRouteLevel(dshOver(dir, web), route)
|
||||
}
|
||||
|
||||
// dshEffortKey is the stash key of the effort magpie last wrote into patch
|
||||
// list f's start, dshNoEffort for none.
|
||||
func dshEffortKey(f string) string { return "dsh-effort:" + f }
|
||||
|
||||
const dshNoEffort = "-"
|
||||
|
||||
// dshEffortWrote records effort as the one magpie wrote into f's start.
|
||||
func dshEffortWrote(f, effort string) {
|
||||
if effort == "" {
|
||||
effort = dshNoEffort
|
||||
}
|
||||
if unstashPeek(dshEffortKey(f)) != effort {
|
||||
stash(map[string]string{dshEffortKey(f): effort})
|
||||
}
|
||||
}
|
||||
|
||||
// dshStartYields takes the effort out of magpie's start in patch list f
|
||||
// where the start's route has a level of its own, another one, and the
|
||||
// effort is the one magpie wrote. A start magpie wrote before it kept
|
||||
// that record is taken for one with magpie's effort.
|
||||
func dshStartYields(f string, items []dshItem) []dshItem {
|
||||
i := dshConfigIndex(items, "agent-default-model")
|
||||
if i < 0 || !items[i].magpie {
|
||||
return items
|
||||
}
|
||||
c := dshConfig(items[i])
|
||||
e := c["reasoningEffort"]
|
||||
if e == "" {
|
||||
return items
|
||||
}
|
||||
if r := dshLevelFor(f, items, c["provider"]); r == "" || r == e {
|
||||
return items
|
||||
}
|
||||
if was := unstashPeek(dshEffortKey(f)); was != "" && was != e {
|
||||
return items // dsh's own save since magpie's: the user's pick
|
||||
}
|
||||
n, err := dshNode(items[i])
|
||||
if err != nil {
|
||||
return items
|
||||
}
|
||||
yamlDelKey(yamlMapping(n, "config"), "reasoningEffort")
|
||||
lines, err := dshNodeLines(n)
|
||||
if err != nil {
|
||||
return items
|
||||
}
|
||||
items[i].lines = lines
|
||||
dshEffortWrote(f, "")
|
||||
return items
|
||||
}
|
||||
|
||||
// dshSetRouteLevel sets v as route's reasoning in a patch list's llm-pi-ai
|
||||
// entry where the route has one already, and says whether it did.
|
||||
func dshSetRouteLevel(items []dshItem, route, v string) bool {
|
||||
i := dshConfigIndex(items, dshPiRow)
|
||||
if i < 0 || dshRouteLevel(items, route) == "" || dshRouteLevel(items, route) == v {
|
||||
return false
|
||||
}
|
||||
n, err := dshNode(items[i])
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
r := yamlKey(yamlKey(yamlKey(n, "config"), "providers"), route)
|
||||
yamlSetKey(r, "reasoning", &yaml.Node{Kind: yaml.ScalarNode, Value: v})
|
||||
lines, err := dshNodeLines(n)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
items[i].lines = lines
|
||||
return true
|
||||
}
|
||||
|
||||
// dshPutLevel sets v as route's level everywhere the route has one: each
|
||||
// profile's list, the home layer and settings.yaml, which dsh 0.2 merges
|
||||
// into the profile it boots.
|
||||
func dshPutLevel(dir, route, v string) error {
|
||||
for _, f := range append(dshProfiles(dir), dshHomePatch(dir)) {
|
||||
head, items, err := dshRead(f)
|
||||
if err != nil || !dshSetRouteLevel(items, route, v) {
|
||||
continue
|
||||
}
|
||||
if err := dshWrite(f, head, items); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
path := dshSettings(dir)
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
return nil
|
||||
}
|
||||
return edit.EditYAMLNode(path, dshPiRow+".providers."+route, func(n *yaml.Node) (bool, bool) {
|
||||
r := yamlKey(n, "reasoning")
|
||||
if r == nil || r.Kind != yaml.ScalarNode || r.Value == v {
|
||||
return false, false
|
||||
}
|
||||
yamlSetKey(n, "reasoning", &yaml.Node{Kind: yaml.ScalarNode, Value: v})
|
||||
return true, false
|
||||
})
|
||||
}
|
||||
|
||||
// dshFiles are the patch lists magpie writes: every profile's, else
|
||||
// config.yaml.
|
||||
func dshFiles(dir string) []string {
|
||||
@@ -3107,7 +3278,11 @@ func dshGetEffort(dir, lead string) string {
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return dshEffortOf(dshOver(dir, items))
|
||||
if e := dshEffortOf(dshOver(dir, items)); e != "" {
|
||||
return e
|
||||
}
|
||||
// none named: sessions start on their route's own level
|
||||
return dshLevelFor(f, items, dshStartSel(dir, dshOver(dir, items))["provider"])
|
||||
}
|
||||
|
||||
// dshSetEffort writes v as the effort sessions start with: into
|
||||
@@ -3144,6 +3319,15 @@ func dshSetEffort(dir, v, gw, lead string) error {
|
||||
}
|
||||
return fmt.Errorf("pick a model for DeepSeek Harness first; the effort is kept with it")
|
||||
}
|
||||
// a start on a route with a level of its own: that level is the
|
||||
// one set (dshRouteLevel)
|
||||
if viaGateway && v != "" {
|
||||
if _, items, err := dshLook(dshLead(dir, lead)); err == nil && dshLevelFor(dshLead(dir, lead), items, route) != "" {
|
||||
if err := dshPutLevel(dir, route, v); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, f := range files {
|
||||
head, items, err := dshRead(f)
|
||||
if err != nil {
|
||||
@@ -3166,7 +3350,11 @@ func dshSetEffort(dir, v, gw, lead string) error {
|
||||
if i >= 0 && !dshOurs(items[i]) {
|
||||
stash(map[string]string{dshStashKey(f, "agent-default-model"): strings.Join(items[i].lines, "\n")})
|
||||
}
|
||||
it := dshItem{id: "agent-default-model", magpie: true, lines: dshDefaultLines(p, m, v)}
|
||||
e := v
|
||||
if dshLevelFor(f, items, p) != "" {
|
||||
e = ""
|
||||
}
|
||||
it := dshItem{id: "agent-default-model", magpie: true, lines: dshDefaultLines(p, m, e)}
|
||||
if i >= 0 {
|
||||
items[i] = it
|
||||
} else {
|
||||
@@ -3175,6 +3363,7 @@ func dshSetEffort(dir, v, gw, lead string) error {
|
||||
if err := dshWrite(f, head, items); err != nil {
|
||||
return err
|
||||
}
|
||||
dshEffortWrote(f, e)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// dshStartEffort is the reasoningEffort of patch list f's start entry.
|
||||
func dshStartEffort(t *testing.T, f string) string {
|
||||
t.Helper()
|
||||
_, items, err := dshLook(f)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if i := dshFindLast(items, "agent-default-model"); i >= 0 {
|
||||
return dshConfig(items[i])["reasoningEffort"]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// dshSaveStartEffort writes e into f's start entry as dsh's own composer
|
||||
// pick does: the entry keeps magpie's mark (#1392).
|
||||
func dshSaveStartEffort(t *testing.T, f, e string) {
|
||||
t.Helper()
|
||||
head, items, err := dshRead(f)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
i := dshFindLast(items, "agent-default-model")
|
||||
if i < 0 {
|
||||
t.Fatalf("no start in %s", f)
|
||||
}
|
||||
n, err := dshNode(items[i])
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
yamlSetKey(yamlMapping(n, "config"), "reasoningEffort", &yaml.Node{Kind: yaml.ScalarNode, Value: e})
|
||||
if items[i].lines, err = dshNodeLines(n); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := dshWrite(f, head, items); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
// A thinking level the user set on one of magpie's routes by hand
|
||||
// (providers.magpie-responses.reasoning, ming_li52905 on X) is what dsh's
|
||||
// sessions on that route start with: magpie's thinking default no longer
|
||||
// names an effort over it, on a sync, a round, a switch or a set.
|
||||
func TestDshRouteLevelOfTheUsersOwn(t *testing.T) {
|
||||
home, dir, web := dshProtocolHome(t)
|
||||
dshKeyFixture(dir)
|
||||
a := dsh(home)
|
||||
if err := a.Field("model").Set("magpie/resp/gpt-5.5"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Field("effort").Set("medium"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if e := dshStartEffort(t, web); e != "medium" {
|
||||
t.Fatalf("before the level: start effort %q, want medium", e)
|
||||
}
|
||||
// the user's own level, by hand, in the profile and in settings.yaml
|
||||
b, err := os.ReadFile(web)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s := strings.Replace(string(b), " magpie-responses:\n", " magpie-responses:\n reasoning: high\n", 1)
|
||||
if s == string(b) {
|
||||
t.Fatalf("no magpie-responses route in the profile:\n%s", b)
|
||||
}
|
||||
if err := os.WriteFile(web, []byte(s), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
settings := filepath.Join(dir, "settings.yaml")
|
||||
sb, err := os.ReadFile(settings)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ss := strings.Replace(string(sb), " magpie-responses:\n", " magpie-responses:\n reasoning: high\n", 1)
|
||||
if ss == string(sb) {
|
||||
t.Fatalf("no magpie-responses route in settings.yaml:\n%s", sb)
|
||||
}
|
||||
if err := os.WriteFile(settings, []byte(ss), 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
level := func(step, want string) {
|
||||
t.Helper()
|
||||
if !strings.Contains(dshRouteLevelText(t, web), "reasoning: "+want) {
|
||||
t.Errorf("%s: profile's route level gone or not %s:\n%s", step, want, dshRead1(t, web))
|
||||
}
|
||||
if b, _ := os.ReadFile(settings); !strings.Contains(string(b), "reasoning: "+want) {
|
||||
t.Errorf("%s: settings.yaml's route level gone or not %s:\n%s", step, want, b)
|
||||
}
|
||||
if e := dshStartEffort(t, web); e != "" {
|
||||
t.Errorf("%s: start still names effort %q over the route's %s:\n%s", step, e, want, dshRead1(t, web))
|
||||
}
|
||||
if got := a.Field("effort").Get(); got != want {
|
||||
t.Errorf("%s: thinking reads %q, want the route's %s", step, got, want)
|
||||
}
|
||||
}
|
||||
if err := a.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
level("sync", "high")
|
||||
before := dshRead1(t, web)
|
||||
dshWiredOnce()
|
||||
level("round", "high")
|
||||
if after := dshRead1(t, web); after != before {
|
||||
t.Errorf("a round after the sync rewrote the profile:\n%s\n----\n%s", before, after)
|
||||
}
|
||||
if err := a.Field("model").Set("magpie/anth/claude-sonnet-5"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Field("model").Set("magpie/resp/gpt-5.5"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
level("switch back", "high")
|
||||
if err := a.Field("effort").Set("low"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
level("thinking low", "low")
|
||||
|
||||
// an effort dsh saves itself into the start is the user's and stays
|
||||
dshSaveStartEffort(t, web, "medium")
|
||||
if err := a.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
dshWiredOnce()
|
||||
if e := dshStartEffort(t, web); e != "medium" {
|
||||
t.Errorf("dsh's own saved effort went: %q, want medium:\n%s", e, dshRead1(t, web))
|
||||
}
|
||||
}
|
||||
|
||||
// A route with no level of its own still starts on magpie's thinking.
|
||||
func TestDshRouteWithoutLevelTakesMagpiesEffort(t *testing.T) {
|
||||
home, dir, web := dshProtocolHome(t)
|
||||
dshKeyFixture(dir)
|
||||
a := dsh(home)
|
||||
if err := a.Field("model").Set("magpie/anth/claude-sonnet-5"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Field("effort").Set("max"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
dshWiredOnce()
|
||||
if e := dshStartEffort(t, web); e != "max" {
|
||||
t.Errorf("start effort %q, want magpie's max:\n%s", e, dshRead1(t, web))
|
||||
}
|
||||
if got := a.Field("effort").Get(); got != "max" {
|
||||
t.Errorf("thinking reads %q, want max", got)
|
||||
}
|
||||
}
|
||||
|
||||
func dshRead1(t *testing.T, f string) string {
|
||||
t.Helper()
|
||||
b, err := os.ReadFile(f)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// dshRouteLevelText is magpie-responses' route in f's llm-pi-ai entry, as
|
||||
// YAML.
|
||||
func dshRouteLevelText(t *testing.T, f string) string {
|
||||
t.Helper()
|
||||
_, items, err := dshLook(f)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r := dshRoutesIn(items)["magpie-responses"]
|
||||
if r == nil {
|
||||
return ""
|
||||
}
|
||||
out, err := yaml.Marshal(r)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return string(out)
|
||||
}
|
||||
|
||||
// A level set in the home layer, whose llm-pi-ai entry dsh reads over each
|
||||
// profile's, is the route's level for the profiles and the home layer's own
|
||||
// start alike.
|
||||
func TestDshRouteLevelInTheHomeLayer(t *testing.T) {
|
||||
home, dir, web := dshProtocolHome(t)
|
||||
dshKeyFixture(dir)
|
||||
a := dsh(home)
|
||||
if err := a.Field("model").Set("magpie/resp/gpt-5.5"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Field("effort").Set("medium"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
hp := dshHomePatch(dir)
|
||||
s := strings.Replace(dshRead1(t, web), " magpie-responses:\n", " magpie-responses:\n reasoning: high\n", 1)
|
||||
if err := os.WriteFile(hp, []byte(s), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := a.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
dshWiredOnce()
|
||||
for _, f := range []string{web, hp} {
|
||||
if e := dshStartEffort(t, f); e != "" {
|
||||
t.Errorf("%s: start still names effort %q over the home layer's high:\n%s", f, e, dshRead1(t, f))
|
||||
}
|
||||
}
|
||||
if !strings.Contains(dshRouteLevelText(t, hp), "reasoning: high") {
|
||||
t.Errorf("home layer's level gone:\n%s", dshRead1(t, hp))
|
||||
}
|
||||
if got := a.Field("effort").Get(); got != "high" {
|
||||
t.Errorf("thinking reads %q, want the home layer's high", got)
|
||||
}
|
||||
if err := a.Field("effort").Set("low"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(dshRouteLevelText(t, hp), "reasoning: low") {
|
||||
t.Errorf("thinking low left the home layer's level:\n%s", dshRead1(t, hp))
|
||||
}
|
||||
for _, f := range []string{web, hp} {
|
||||
if e := dshStartEffort(t, f); e != "" {
|
||||
t.Errorf("%s: thinking low wrote effort %q:\n%s", f, e, dshRead1(t, f))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user