pingqipai3 asked for Codex's Ultra effort on every model, so Codex uses subagents more. Codex offers a level only where the model's catalog entry lists it, and magpie listed Ultra only on OpenAI's own models. What Codex does with it (openai/codex 553c764): Ultra is never sent. ModelInfo::resolve_reasoning_effort sends the entry's multi_agent_reasoning_effort, else max, else its highest other level; and under MultiAgent V2, Ultra is what makes subagents proactive (effective_multi_agent_mode). So Ultra on another vendor's model asks it its own top level, which is honest, and turns on V2's proactive subagents. codexcat.entriesAt now ends the levels of a model that lists some, from a vendor other than OpenAI, with "ultra" and says multi_agent_version v2 (ultraHere). Left alone: GPT, o-series and Codex models (their Ultra is provider.OffersUltra's), a model with no levels, Fast and Seals entries (V1 stays theirs), a vendor's own Codex entry (listedEntry). The default level is never Ultra. catalogFormat goes to v3, so Codex fetches the list again. Only Codex's catalog changes; other agents' level lists don't. docs/subsystems/agent-wiring.md has a row for it. Run: at origin/main54b6d4d39+ these three commits (c63a6d674, mica): gofmt -l clean; go vet ./internal/{codexcat,gui,agent,gateway,provider, catalog,usage} on darwin, GOOS=linux -tags nogui and GOOS=windows ok; go test -count=1 of those seven packages: all ok. Rebased onto origin/main21ed46106after that run (main's gateway, provider and i18n.js changes): provider, gui, codexcat and gateway-model-info, i18n-keys, gui-zh-tw run again there (mica): Go all ok, GUI 8 of 9; i18n-keys is red on "No folder" from72facf72eon main (#6423), not this change. The full suite runs after the tag. The provider tests that read Codex's list (TestCPAVariantModelsBorrowLevels, TestGroupQuietMemberKeepsCodexEffortControl, TestCodexOffersLevelsForUnknownModels) now expect ultra at the end. Broken by hand: ultraHere returning false turns TestUltraOnOtherVendorsModels red (claude-opus-4-8, glm-5.3, deepseek-v4-pro, group/mixed: no ultra, no v2). Not tried: a real Codex session picking Ultra on a non-GPT model and watching it spawn subagents; magpie's own Codex effort control (codexEfforts) still doesn't list Ultra for these models; a Codex app [desktop] enabled-reasoning-efforts the user set without "ultra" is left as they set it.
62 lines
2.0 KiB
Go
62 lines
2.0 KiB
Go
package agent
|
|
|
|
import (
|
|
"encoding/json"
|
|
"path/filepath"
|
|
"slices"
|
|
"testing"
|
|
|
|
"github.com/yetone/magpie/internal/provider"
|
|
)
|
|
|
|
// ccdcn on X: in the Codex app, the models of a provider the user added
|
|
// (XJAI's model-code, model-work, model-test), which nothing magpie reads
|
|
// knows, had no reasoning effort to pick. magpie-models.json, which Codex
|
|
// reads them from, now offers them low, medium and high, as GET
|
|
// /v1/codex/models does (provider.CodexEfforts).
|
|
func TestCodexCatalogOffersUnknownModelsLevels(t *testing.T) {
|
|
home := syncHome(t)
|
|
if err := provider.Save(provider.Provider{ID: "xjai", Name: "XJAI", Key: "k", Chat: "http://127.0.0.1:1/v1", Models: []string{"model-code", "model-work", "model-test"}}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
cx := codex(home)
|
|
if err := cx.Fields[0].Set("xjai/model-test"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var got struct {
|
|
Models []struct {
|
|
Slug string `json:"slug"`
|
|
Default *string `json:"default_reasoning_level"`
|
|
Levels []struct {
|
|
Effort string `json:"effort"`
|
|
} `json:"supported_reasoning_levels"`
|
|
} `json:"models"`
|
|
}
|
|
raw := readFile(filepath.Join(home, ".codex", "magpie-models.json"))
|
|
if err := json.Unmarshal([]byte(raw), &got); err != nil {
|
|
t.Fatalf("%v: %s", err, raw)
|
|
}
|
|
seen := 0
|
|
for _, m := range got.Models {
|
|
if m.Slug != "xjai/model-code" && m.Slug != "xjai/model-work" && m.Slug != "xjai/model-test" {
|
|
continue
|
|
}
|
|
seen++
|
|
var ls []string
|
|
for _, l := range m.Levels {
|
|
ls = append(ls, l.Effort)
|
|
}
|
|
// and Ultra, which Codex sends as high, the top of them (pingqipai3 on X)
|
|
if !slices.Equal(ls, []string{"low", "medium", "high", "ultra"}) || m.Default == nil {
|
|
t.Errorf("%s offers %v (default %v), want low, medium, high, ultra", m.Slug, ls, m.Default)
|
|
}
|
|
}
|
|
if seen != 3 {
|
|
t.Errorf("%d of XJAI's models in magpie-models.json: %s", seen, raw)
|
|
}
|
|
// and magpie's own effort control for Codex offers the same
|
|
if opts := codexEfforts(magpieModels("codex"), "xjai/model-test"); len(opts) != 4 || opts[0].Value != "" {
|
|
t.Errorf("effort control: %+v", opts)
|
|
}
|
|
}
|