agent: Claude Code's fable tier is left unset on another vendor's model too (#2090)

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.
This commit is contained in:
yetone
2026-10-14 15:34:16 +08:00
parent 273ab9c235
commit 019404940b
6 changed files with 51 additions and 22 deletions
+9 -9
View File
@@ -341,15 +341,15 @@ func claudeCapabilities(first []string, own, desktop bool) string {
// subscription costs a fraction of Opus's limits (X, AncientTwo: the limits
// went much faster through magpie than in Claude Code itself).
//
// For fable, on a Claude model that is no Fable, it is none: the fable tier
// is left unset. Claude Code takes the model ANTHROPIC_DEFAULT_FABLE_MODEL
// For fable, on any model that is no Fable, it is none: the fable tier is
// left unset. Claude Code takes the model ANTHROPIC_DEFAULT_FABLE_MODEL
// names for a Fable model (2.1.293: a model id equal to it is Fable), so the
// main model written there made Claude Opus a Fable model to it, and on a
// Claude Pro sign-in without Fable it asked for usage credits and fell back
// to Haiku (Zhenzhen on Discord). Claude Code's own /model fable, asked of
// the gateway, still runs on the main model (claudeStandInAt). Another
// vendor's model, which Claude Code knows nothing of, the fable tier still
// follows, as it does the others.
// main model written there made it a Fable model to Claude Code, and on a
// Claude Pro sign-in without Fable it asked for usage credits before the
// first turn: Claude Opus fell back to Haiku (Zhenzhen on Discord), and
// another vendor's model, GPT-6.1 Sol through Codex, didn't run at all
// (#2090). Claude Code's own /model fable, asked of the gateway, still runs
// on the main model (claudeStandInAt).
func follow(tier, main string) string {
switch tier {
case "haiku":
@@ -357,7 +357,7 @@ func follow(tier, main string) string {
return l
}
case "fable":
if n := claudeName(main); n != "" && !strings.HasPrefix(n, "claude-fable-") {
if !strings.HasPrefix(claudeName(main), "claude-fable-") {
return ""
}
}
+3 -1
View File
@@ -41,7 +41,9 @@ func TestClaude1MMarked(t *testing.T) {
}
names := []string{"model", "env.ANTHROPIC_SMALL_FAST_MODEL"}
for _, tier := range claudeTiers {
names = append(names, "env."+tierEnv(tier))
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]"} {
+4 -2
View File
@@ -70,8 +70,10 @@ func TestClaudeTierNamesGoWithTheirModel(t *testing.T) {
if err := a.Apply("model", "opencode-go/deepseek-flash"); err != nil {
t.Fatal(err)
}
if v, _ := edit.GetJSON(path, "env.ANTHROPIC_DEFAULT_FABLE_MODEL"); v != "opencode-go/deepseek-flash" {
t.Fatalf("fable not on magpie's model:\n%s", readFile(path))
// the user's own fable model goes too, and on a model that is
// no Fable magpie leaves the tier unset (#2090)
if v, has := edit.GetJSON(path, "env.ANTHROPIC_DEFAULT_FABLE_MODEL"); has {
t.Fatalf("fable left on %q:\n%s", v, readFile(path))
}
if left := claudeAboutLeft(path); len(left) > 0 {
t.Fatalf("the user's own models' names left on magpie's: %v", left)
+31 -7
View File
@@ -14,8 +14,8 @@ import (
// ANTHROPIC_DEFAULT_FABLE_MODEL names for a Fable model, so Opus written
// there was Fable to it, and a Claude Pro sign-in without Fable asked for
// usage credits and fell back to Haiku (Zhenzhen on Discord, magpie claude
// claude/claude-opus-5-5). On a Fable, or another vendor's model, it follows
// as before; a value of the user's own stays theirs.
// claude/claude-opus-5-5). So it is on another vendor's model (#2090). On a
// Fable it follows as before; a value of the user's own stays theirs.
func TestClaudeFableTierOnClaude(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)
@@ -25,6 +25,7 @@ func TestClaudeFableTierOnClaude(t *testing.T) {
for _, p := range []provider.Provider{
{ID: "anth", Name: "Anthropic", Chat: "https://api.anthropic.com/v1", Key: "k", Models: []string{"claude-opus-5-5", "claude-sonnet-5", "claude-fable-5-1", "claude-haiku-4-5"}},
{ID: "deepseek", Name: "DeepSeek", Chat: "https://api.deepseek.com/v1", Key: "k", Models: []string{"pro", "flash"}},
{ID: "cx", Name: "Codex models", Chat: "https://codex.invalid/v1", Key: "k", Models: []string{"gpt-6.1-sol"}},
} {
if err := provider.Save(p); err != nil {
t.Fatal(err)
@@ -78,17 +79,40 @@ func TestClaudeFableTierOnClaude(t *testing.T) {
t.Fatal(err)
}
noFable("back from Fable")
// another vendor's model: it follows as before
if err := a.Field("model").Set("deepseek/pro"); err != nil {
// another vendor's model is no Fable either: GPT-6.1 Sol written there
// was Fable to Claude Code, which asked for usage credits before Sol's
// first turn (#2090)
for _, m := range []string{"cx/gpt-6.1-sol", "deepseek/pro"} {
if err := a.Field("model").Set(m); err != nil {
t.Fatal(err)
}
noFable("on " + m)
if env("ANTHROPIC_DEFAULT_OPUS_MODEL") != m || env("ANTHROPIC_DEFAULT_SONNET_MODEL") != m || env("ANTHROPIC_DEFAULT_HAIKU_MODEL") != m {
t.Fatalf("on %s the other tiers should follow:\n%s", m, readFile(path))
}
if got := claudeStandInAt(path, "claude-fable-5-1", env("ANTHROPIC_BASE_URL")); got != m {
t.Fatalf("on %s claude-fable-5-1 stands in as %q", m, got)
}
}
// 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)
}
if v, _ := fable(); v != "deepseek/pro" {
t.Fatalf("on deepseek, fable is %q", v)
if err := a.Field("model").Set("cx/gpt-6.1-sol"); err != nil {
t.Fatal(err)
}
if err := edit.SetJSON(path, edit.KV{Path: "env.ANTHROPIC_DEFAULT_FABLE_MODEL", Value: "cx/gpt-6.1-sol"}); err != nil {
t.Fatal(err)
}
if err := a.Follow(); err != nil {
t.Fatal(err)
}
noFable("Sol's older wiring after Follow")
if err := a.Field("model").Set("anth/claude-opus-5-5"); err != nil {
t.Fatal(err)
}
noFable("back from deepseek")
noFable("back from another vendor")
// the user's pick of the main model for fable is theirs: it stays
if err := a.Field("fable").Set("anth/claude-opus-5-5"); err != nil {
+3 -2
View File
@@ -53,8 +53,9 @@ func TestClaudeTiers(t *testing.T) {
if err := a.Field("model").Set("deepseek/pro"); err != nil {
t.Fatal(err)
}
if env("ANTHROPIC_DEFAULT_SONNET_MODEL") != "deepseek/pro" || env("ANTHROPIC_DEFAULT_FABLE_MODEL") != "deepseek/pro" {
t.Fatalf("sonnet/fable should follow: %v", a.Values())
// fable is left unset on a model that is no Fable (#2090)
if env("ANTHROPIC_DEFAULT_SONNET_MODEL") != "deepseek/pro" || env("ANTHROPIC_DEFAULT_FABLE_MODEL") != "" {
t.Fatalf("sonnet should follow, fable be unset: %v", a.Values())
}
if err := a.Field("haiku").Set(""); err != nil {
t.Fatal(err)
+1 -1
View File
@@ -92,7 +92,7 @@ func TestClaudeTierEffort(t *testing.T) {
// one of its own keeps its model
set("model", "v/flash")
if env("ANTHROPIC_DEFAULT_SONNET_MODEL") != "v/flash:medium" || env("ANTHROPIC_DEFAULT_HAIKU_MODEL") != "v/flash:low" ||
env("ANTHROPIC_DEFAULT_OPUS_MODEL") != "v/big:high[1m]" || env("ANTHROPIC_DEFAULT_FABLE_MODEL") != "v/flash" {
env("ANTHROPIC_DEFAULT_OPUS_MODEL") != "v/big:high[1m]" || env("ANTHROPIC_DEFAULT_FABLE_MODEL") != "" {
t.Fatalf("new main model: %v", a.Values())
}
// the tier's effort taken away: its model as before