With Claude Code on codex/gpt-6.1-sol and the tiers following it,
magpie wrote ANTHROPIC_DEFAULT_FABLE_MODEL=codex/gpt-6.1-sol. Claude
Code takes the model that variable names for a Fable model, so on a
claude.ai Pro sign-in without usage credits it stopped Sol's first turn
with "Fable now uses usage credits" and, after Escape, "Your model
policy only allows Fable". follow already left the fable tier unset on a
Claude model that is no Fable (Zhenzhen on Discord); claudeName is ""
for another vendor's model, so the exception never reached it.
follow now leaves the fable tier unset on any model that is no Fable,
and follows only a Claude Fable. Claude Code's own /model fable, asked
of the gateway, still runs on the main model (claudeStandInAt). A
settings.json an older magpie wrote, fable on the main model, is taken
out on the next Follow by the check that already did it for Opus. The
user's own fable pick, or the main model at a fable effort of its own,
is kept as before.
Run:
- TestClaudeFableTierOnClaude: Sol (cx/gpt-6.1-sol) and DeepSeek as the
main model leave the fable tier out while opus/sonnet/haiku follow,
claude-fable-5-1 stands in as the main model; the reporter's
settings.json (fable on Sol) is cleaned by Follow; Opus, Sonnet and a
real Fable as before. FAILs on the old follow ("fable tier written as
cx/gpt-6.1-sol").
- TestClaudeTiers, TestClaudeTierEffort, TestClaudeTierNamesGoWithTheirModel
and TestClaude1MMarked asserted the fable tier on another vendor's
model, the behaviour #2090 reports; updated to expect it unset.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/agent; go test -tags nogui -timeout 40m ./internal/agent/
(one failure, TestClaude1MMarked, then fixed and rerun with the tier
tests).
Not tried: a real Claude Code 2.1.299 session on a Pro sign-in.
69 lines
2.2 KiB
Go
69 lines
2.2 KiB
Go
package agent
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/yetone/magpie/internal/catalog"
|
|
"github.com/yetone/magpie/internal/edit"
|
|
"github.com/yetone/magpie/internal/provider"
|
|
)
|
|
|
|
// TestClaude1MMarked: every name magpie hands Claude Code for a model of a
|
|
// 1M window carries [1m], however it was set: Claude Code 2.1.284 and before
|
|
// take "claude/claude-opus-5-5" unmarked for 200K, whatever
|
|
// CLAUDE_CODE_MAX_CONTEXT_TOKENS says, and compact it again and again
|
|
// ("Autocompact is thrashing").
|
|
func TestClaude1MMarked(t *testing.T) {
|
|
home := t.TempDir()
|
|
t.Setenv("HOME", home)
|
|
t.Setenv("USERPROFILE", home)
|
|
t.Setenv("XDG_CONFIG_HOME", filepath.Join(home, ".config"))
|
|
t.Setenv("XDG_CACHE_HOME", filepath.Join(home, ".cache"))
|
|
if err := provider.Save(provider.Provider{ID: "v", Name: "V", Chat: "https://example.test/v1", Key: "k",
|
|
Models: []string{"small", "big"}}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := catalog.SaveLive("v", "https://example.test/v1", []catalog.Model{
|
|
{ID: "small", Context: 200000}, {ID: "big", Context: 1000000},
|
|
}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
path := filepath.Join(home, ".claude", "settings.json")
|
|
writeFile(t, path, `{}`)
|
|
a := claude(home)
|
|
get := func(k string) string { v, _ := edit.GetJSON(path, k); return v }
|
|
set := func(key, v string) {
|
|
t.Helper()
|
|
if err := a.Field(key).Set(v); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
names := []string{"model", "env.ANTHROPIC_SMALL_FAST_MODEL"}
|
|
for _, tier := range claudeTiers {
|
|
if tier != "fable" { // left unset on a model that is no Fable (#2090)
|
|
names = append(names, "env."+tierEnv(tier))
|
|
}
|
|
}
|
|
|
|
for _, v := range []string{"v/big", "v/big[1m]"} {
|
|
set("model", v)
|
|
for _, k := range names {
|
|
if got := get(k); got != "v/big[1m]" {
|
|
t.Fatalf("model %q: %s = %q, want v/big[1m]", v, k, got)
|
|
}
|
|
}
|
|
}
|
|
// a tier set on its own is marked too; a 200K one is not
|
|
set("model", "v/small")
|
|
if got := get("model"); got != "v/small" {
|
|
t.Fatalf("a 200K model got marked: %q", got)
|
|
}
|
|
set("haiku", "v/big")
|
|
for _, k := range []string{"env." + tierEnv("haiku"), "env.ANTHROPIC_SMALL_FAST_MODEL"} {
|
|
if got := get(k); got != "v/big[1m]" {
|
|
t.Fatalf("haiku on v/big: %s = %q", k, got)
|
|
}
|
|
}
|
|
}
|